Commit Graph

225569 Commits

Author SHA1 Message Date
Jason Merrill
a5fa3cc54e libcpp: adjust _cpp_file accessors
Back in r78875 mrs added cpp_get_path/dir accessors for _cpp_file in order
to interface with the darwin framework system.  But now I notice that the
latter duplicates the better-named _cpp_get_file_dir, and I'm inclined to
rename the former to match.

Perhaps we should drop the initial underscore since these are no
longer internal interfaces; OTOH, _cpp_hashnode_value and
_cpp_backup_tokens still have the initial underscore in cpplib.h.

libcpp/ChangeLog:

	* include/cpplib.h (cpp_get_path, cpp_get_dir): Remove.
	(_cpp_get_file_path, _cpp_get_file_name, _cpp_get_file_stat)
	(_cpp_get_file_dir): Move prototypes from...
	* internal.h: ...here.
	* files.cc (_cpp_get_file_path): Rename from...
	(cpp_get_path): ...this.
	(cpp_get_dir): Remove.

gcc/ChangeLog:

	* config/darwin-c.cc (find_subframework_header): Use
	_cpp_get_file_*.
2025-12-07 15:34:15 +08:00
H.J. Lu
a6c50ec2c6 Add -ffuse-ops-with-volatile-access
Volatile memory can be used as source operand for any operations.  Add
-ffuse-ops-with-volatile-access to fuse operations with volatile memory
reference and update simplify_binary_operation_1 to keep PLUS for 2
volatile memory references.  On x86, this optimizes

extern volatile int bar;

int
foo (int z)
{
  z *= 123;
  return bar + z;
}

into

foo:
	imull	$123, %edi, %eax
	addl	bar(%rip), %eax
	ret

and compile

extern volatile unsigned char u8;

void
test (void)
{
  u8 = u8 + u8;
  u8 = u8 - u8;
}

into

test:
	movzbl	u8(%rip), %eax
	addb	%al, u8(%rip)
	movzbl	u8(%rip), %eax
	subb	u8(%rip), %al
	movb	%al, u8(%rip)
	ret

Tested with Linux kernel 6.17.9 on Intel Core i7-1195G7.

gcc/

	PR target/122343
	* common.opt: Add -ffuse-ops-with-volatile-access.
	* common.opt.urls: Regenerated.
	* recog.cc (general_operand): Allow volatile memory reference if
	-ffuse-ops-with-volatile-access is enabled.
	* simplify-rtx.cc (simplify_binary_operation_1): Keep PLUS for 2
	volatile memory references.
	* doc/invoke.texi: Document -ffuse-ops-with-volatile-access.

gcc/testsuite/

	PR target/122343
	* gcc.target/i386/20040112-1.c: Add -fomit-frame-pointer and use
	check-function-bodies to check for loop.
	* gcc.target/i386/avx-ne-convert-1.c: Compile with
	-fno-fuse-ops-with-volatile-access.
	* gcc.target/i386/avx10_2-bf16-1.c: Likewise.
	* gcc.target/i386/avx10_2-convert-1.c: Likewise.
	* gcc.target/i386/avx10_2-satcvt-1.c: Likewise.
	* gcc.target/i386/avx512bf16-vcvtneps2bf16-1.c: Likewise.
	* gcc.target/i386/avx512bf16vl-vcvtneps2bf16-1a.c: Likewise.
	* gcc.target/i386/avx512bf16vl-vcvtneps2bf16-1b.c: Likewise.
	* gcc.target/i386/avx512bitalg-vpshufbitqmb.c: Likewise.
	* gcc.target/i386/avx512bw-vpcmpb-1.c: Likewise.
	* gcc.target/i386/avx512bw-vpcmpub-1.c: Likewise.
	* gcc.target/i386/avx512bw-vpcmpuw-1.c: Likewise.
	* gcc.target/i386/avx512bw-vpcmpw-1.c: Likewise.
	* gcc.target/i386/avx512dq-vcvtps2qq-1.c: Likewise.
	* gcc.target/i386/avx512dq-vcvtps2uqq-1.c: Likewise.
	* gcc.target/i386/avx512dq-vcvtqq2pd-1.c: Likewise.
	* gcc.target/i386/avx512dq-vcvtqq2ps-1.c: Likewise.
	* gcc.target/i386/avx512dq-vcvttps2qq-1.c: Likewise.
	* gcc.target/i386/avx512dq-vcvttps2uqq-1.c: Likewise.
	* gcc.target/i386/avx512dq-vcvtuqq2pd-1.c: Likewise.
	* gcc.target/i386/avx512dq-vcvtuqq2ps-1.c: Likewise.
	* gcc.target/i386/avx512dq-vextractf32x8-1.c: Likewise.
	* gcc.target/i386/avx512dq-vextractf64x2-1.c: Likewise.
	* gcc.target/i386/avx512dq-vextracti64x2-1.c: Likewise.
	* gcc.target/i386/avx512dq-vfpclasspd-1.c: Likewise.
	* gcc.target/i386/avx512dq-vfpclassps-1.c: Likewise.
	* gcc.target/i386/avx512dq-vfpclasssd-1.c: Likewise.
	* gcc.target/i386/avx512dq-vfpclassss-1.c: Likewise.
	* gcc.target/i386/avx512dq-vpmullq-1.c: Likewise.
	* gcc.target/i386/avx512dq-vpmullq-3.c: Likewise.
	* gcc.target/i386/avx512f-pr100267-1.c: Likewise.
	* gcc.target/i386/avx512f-vcmppd-1.c: Likewise.
	* gcc.target/i386/avx512f-vcmpps-1.c: Likewise.
	* gcc.target/i386/avx512f-vcvtps2pd-1.c: Likewise.
	* gcc.target/i386/avx512f-vcvtsd2si-1.c: Likewise.
	* gcc.target/i386/avx512f-vcvtsd2si64-1.c: Likewise.
	* gcc.target/i386/avx512f-vcvtsd2usi-1.c: Likewise.
	* gcc.target/i386/avx512f-vcvtsd2usi64-1.c: Likewise.
	* gcc.target/i386/avx512f-vcvtsi2ss-1.c: Likewise.
	* gcc.target/i386/avx512f-vcvtss2si-1.c: Likewise.
	* gcc.target/i386/avx512f-vcvtss2si64-1.c: Likewise.
	* gcc.target/i386/avx512f-vcvtss2usi-1.c: Likewise.
	* gcc.target/i386/avx512f-vcvtss2usi64-1.c: Likewise.
	* gcc.target/i386/avx512f-vcvttsd2si-1.c: Likewise.
	* gcc.target/i386/avx512f-vcvttsd2si64-1.c: Likewise.
	* gcc.target/i386/avx512f-vcvttsd2usi-1.c: Likewise.
	* gcc.target/i386/avx512f-vcvttsd2usi64-1.c: Likewise.
	* gcc.target/i386/avx512f-vcvttss2si-1.c: Likewise.
	* gcc.target/i386/avx512f-vcvttss2si64-1.c: Likewise.
	* gcc.target/i386/avx512f-vcvttss2usi-1.c: Likewise.
	* gcc.target/i386/avx512f-vcvttss2usi64-1.c: Likewise.
	* gcc.target/i386/avx512f-vextractf32x4-1.c: Likewise.
	* gcc.target/i386/avx512f-vextractf64x4-1.c: Likewise.
	* gcc.target/i386/avx512f-vextracti64x4-1.c: Likewise.
	* gcc.target/i386/avx512f-vmovapd-1.c: Likewise.
	* gcc.target/i386/avx512f-vmovaps-1.c: Likewise.
	* gcc.target/i386/avx512f-vmovdqa64-1.c: Likewise.
	* gcc.target/i386/avx512f-vpandnq-1.c: Likewise.
	* gcc.target/i386/avx512f-vpbroadcastd-1.c: Likewise.
	* gcc.target/i386/avx512f-vpbroadcastq-1.c: Likewise.
	* gcc.target/i386/avx512f-vpcmpd-1.c: Likewise.
	* gcc.target/i386/avx512f-vpcmpeqq-1.c: Likewise.
	* gcc.target/i386/avx512f-vpcmpequq-1.c: Likewise.
	* gcc.target/i386/avx512f-vpcmpged-1.c: Likewise.
	* gcc.target/i386/avx512f-vpcmpgeq-1.c: Likewise.
	* gcc.target/i386/avx512f-vpcmpgeud-1.c: Likewise.
	* gcc.target/i386/avx512f-vpcmpgeuq-1.c: Likewise.
	* gcc.target/i386/avx512f-vpcmpled-1.c: Likewise.
	* gcc.target/i386/avx512f-vpcmpleq-1.c: Likewise.
	* gcc.target/i386/avx512f-vpcmpleud-1.c: Likewise.
	* gcc.target/i386/avx512f-vpcmpleuq-1.c: Likewise.
	* gcc.target/i386/avx512f-vpcmpltd-1.c: Likewise.
	* gcc.target/i386/avx512f-vpcmpltq-1.c: Likewise.
	* gcc.target/i386/avx512f-vpcmpltud-1.c: Likewise.
	* gcc.target/i386/avx512f-vpcmpltuq-1.c: Likewise.
	* gcc.target/i386/avx512f-vpcmpneqd-1.c: Likewise.
	* gcc.target/i386/avx512f-vpcmpneqq-1.c: Likewise.
	* gcc.target/i386/avx512f-vpcmpnequd-1.c: Likewise.
	* gcc.target/i386/avx512f-vpcmpnequq-1.c: Likewise.
	* gcc.target/i386/avx512f-vpcmpq-1.c: Likewise.
	* gcc.target/i386/avx512f-vpcmpud-1.c: Likewise.
	* gcc.target/i386/avx512f-vpcmpuq-1.c: Likewise.
	* gcc.target/i386/avx512f-vrndscalepd-1.c: Likewise.
	* gcc.target/i386/avx512f-vrndscaleps-1.c: Likewise.
	* gcc.target/i386/avx512fp16-complex-fma.c: Likewise.
	* gcc.target/i386/avx512fp16-vaddph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vcvtpd2ph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vcvtph2dq-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vcvtph2pd-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vcvtph2psx-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vcvtph2qq-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vcvtph2udq-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vcvtph2uqq-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vcvtph2uw-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vcvtph2w-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vcvtps2ph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vcvtqq2ph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vcvttph2dq-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vcvttph2qq-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vcvttph2udq-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vcvttph2uqq-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vcvttph2uw-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vcvttph2w-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vcvtuqq2ph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vfcmaddcph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vfcmulcph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vfmaddcph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vfmulcph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vfpclassph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vfpclasssh-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vmulph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vrcpph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vrsqrtph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16-vsqrtph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16vl-vaddph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16vl-vcvtpd2ph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16vl-vcvtph2dq-1a.c: Likewise.
	* gcc.target/i386/avx512fp16vl-vcvtph2psx-1a.c: Likewise.
	* gcc.target/i386/avx512fp16vl-vcvtph2qq-1a.c: Likewise.
	* gcc.target/i386/avx512fp16vl-vcvtph2udq-1a.c: Likewise.
	* gcc.target/i386/avx512fp16vl-vcvtph2uqq-1a.c: Likewise.
	* gcc.target/i386/avx512fp16vl-vcvtph2uw-1a.c: Likewise.
	* gcc.target/i386/avx512fp16vl-vcvtph2w-1a.c: Likewise.
	* gcc.target/i386/avx512fp16vl-vcvtps2ph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16vl-vcvtqq2ph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16vl-vcvttph2dq-1a.c: Likewise.
	* gcc.target/i386/avx512fp16vl-vcvttph2udq-1a.c: Likewise.
	* gcc.target/i386/avx512fp16vl-vcvttph2uw-1a.c: Likewise.
	* gcc.target/i386/avx512fp16vl-vcvttph2w-1a.c: Likewise.
	* gcc.target/i386/avx512fp16vl-vcvtuqq2ph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16vl-vfcmaddcph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16vl-vfcmulcph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16vl-vfmaddcph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16vl-vfmulcph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16vl-vfpclassph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16vl-vmulph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16vl-vrcpph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16vl-vrsqrtph-1a.c: Likewise.
	* gcc.target/i386/avx512fp16vl-vsqrtph-1a.c: Likewise.
	* gcc.target/i386/avx512vl-pr100267-1.c: Likewise.
	* gcc.target/i386/avx512vl-vcmppd-1.c: Likewise.
	* gcc.target/i386/avx512vl-vcmpps-1.c: Likewise.
	* gcc.target/i386/avx512vl-vcvtpd2ps-1.c: Likewise.
	* gcc.target/i386/avx512vl-vcvtpd2udq-1.c: Likewise.
	* gcc.target/i386/avx512vl-vcvttpd2udq-1.c: Likewise.
	* gcc.target/i386/avx512vl-vcvttps2udq-1.c: Likewise.
	* gcc.target/i386/avx512vl-vextractf32x4-1.c: Likewise.
	* gcc.target/i386/avx512vl-vmovapd-1.c: Likewise.
	* gcc.target/i386/avx512vl-vmovaps-1.c: Likewise.
	* gcc.target/i386/avx512vl-vmovdqa64-1.c: Likewise.
	* gcc.target/i386/avx512vl-vpcmpd-1.c: Likewise.
	* gcc.target/i386/avx512vl-vpcmpeqq-1.c: Likewise.
	* gcc.target/i386/avx512vl-vpcmpequq-1.c: Likewise.
	* gcc.target/i386/avx512vl-vpcmpq-1.c: Likewise.
	* gcc.target/i386/avx512vl-vpcmpud-1.c: Likewise.
	* gcc.target/i386/avx512vl-vpcmpuq-1.c: Likewise.
	* gcc.target/i386/pr122343-1a.c: New test.
	* gcc.target/i386/pr122343-1b.c: Likewise.
	* gcc.target/i386/pr122343-2a.c: Likewise.
	* gcc.target/i386/pr122343-2b.c: Likewise.
	* gcc.target/i386/pr122343-3.c: Likewise.
	* gcc.target/i386/pr122343-4a.c: Likewise.
	* gcc.target/i386/pr122343-4b.c: Likewise.
	* gcc.target/i386/pr122343-5a.c: Likewise.
	* gcc.target/i386/pr122343-5b.c: Likewise.
	* gcc.target/i386/pr122343-6a.c: Likewise.
	* gcc.target/i386/pr122343-6b.c: Likewise.
	* gcc.target/i386/pr122343-7.c: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-12-07 12:03:15 +08:00
Alexandre Oliva
83739ee76d cselib: dump_cselib_* fixes
Rework dump_cselib_table to not crash when cselib_preserved_hash_table
is not allocated, and to remove the extraneous indirection from
dump_cselib_val that made it inconvenient to call from a debugger.


for  gcc/ChangeLog

	* cselib.cc (dump_cselib_val): Split out of and rename to...
	(dump_cselib_val_ptr): ... this.
	(dump_cselib_table): Adjust.  Skip cselib_preserved_hash_table
	when not allocated.
2025-12-06 22:08:04 -03:00
GCC Administrator
c70bf3e009 Daily bump. 2025-12-07 00:16:26 +00:00
Alexandre Oliva
488e28a80e add fusage for non-ACCUMULATE_OUTGOING_ARGS calls [PR122947]
Since we may delete stores that are found to be redundant in
postreload cse, we need cselib to invalidate argument stores at calls,
and to that end we need CALL_INSN_FUNCTION_USAGE to mention all MEM
stack space that may be legitimately modified by a const/pure callee,
i.e., all arguments passed to it on the stack.

When ACCUMULATE_OUTGOING_ARGS, each on-stack argument gets its own
usage information, but when it's not, each argument is pushed
incrementally, without precomputed stack slots.

Since we only mentioned such precomputed stack slots in
CALL_INSN_FUNCTION_USAGE, non-ACCUMULATE_OUTGOING_ARGS configurations
miss the stack usage data, and cselib fails to invalidate the stores.

Stores in such slots are anonymous, and they often invalidate other
anonymous slots, even part of the same object, but as the testcase
demonstrates, we may occasionally be unlucky that consecutive calls
have the stores to multi-word objects reordered by scheduling in such
a way that the last store for the first call survives the call in the
cselib tables, and then it is found to be redundant with the first
store for the subsequent call, as in the testcase.

So, if we haven't preallocated outgoing arguments for a call (which
would give us preassigned stack slots), and we have used any stack
space, add function call usage covering the entire stack range where
arguments were stored.


for  gcc/ChangeLog

	PR rtl-optimization/122947
	* calls.cc (expand_call): Add stack function usage in
	non-ACCUMULATE_OUTGOING_ARGS configurations.

for  gcc/testsuite/ChangeLog

	PR rtl-optimization/122947
	* gcc.dg/pr122947.c: New.
2025-12-06 20:11:46 -03:00
Alexandre Oliva
fb8a9da75a [riscv] avoid auipc overflow with large offsets [PR91420]
When computing an address plus a large offset on riscv64 with a
PC-relative sequence, we may hit the range limit for auipc and get a
relocation overflow, where on riscv32 the computation wraps around.

Since -mcmodel=medany requires the entire program to fit in a 2GiB
address range, a +/-1GiB+ offset added to an in-range symbol in a
barely-fitting program is more likely than not to be out-of-range.
Since such large constants are unlikely to come up by chance, separate
them from the symbol so as to avoid the relocation overflow.


for  gcc/ChangeLog

	PR target/91420
	* config/riscv/riscv.cc (riscv_symbolic_constant_p): Require
	offsets smaller than +/- 1GiB for PCREL symbols.

for  gcc/testsuite/ChangeLog

	PR target/91420
	* gcc.target/riscv/pr91420.c: New.
2025-12-06 20:11:42 -03:00
Denis Mazzucato
55d31324ac Ada: Fix spurious warning if the reducer subprogram is a procedure
If the reducer is a function and the accumulator type isn't constrained,
at runtime the reduction will likely raise a Constraint_Error since the
reducer is repeatedly assigned to the accumulator variable (likely changing
its length). However, if the reducer is a procedure, no such assignment
occurs, and thus the runtime error only depends on the reducer logic.
This patch prevents the spurious warning in that case.

gcc/ada/
	* sem_attr.adb (Resolve_Attribute): Check if the reducer is a
	procedure before giving the warning.
2025-12-06 19:16:54 +01:00
Jeff Law
951f3ccefc Adjust expected output of new risc-v test
Just a minor update to Dimitar's patch for the RISC-V testcase.

The cfi directives are not emitted for the -elf configurations causing the new
test to fail.  The cfi directives (and associated labels) don't seem relevant
to the test at hand, so this just drops them.

Pushing to the trunk.

	PR rtl-optimization/122675

gcc/testsuite
	* gcc.target/riscv/pr122675-1.c: Adjust expected output.
2025-12-06 09:02:11 -07:00
Paul Thomas
c8450ff500 Fortran: [PDT] Verify problems with error recovery have gone [PR103414]
2025-12-06  Paul Thomas  <pault@gcc.gnu.org>

gcc/testsuite
	PR fortran/103414
	* gfortran.dg/pdt_76.f03: New test.
2025-12-06 12:58:30 +00:00
Jason Merrill
da97de41f8 libstdc++: add more #if to std.cc
compile-std1.C was breaking on arm-eabi because these interfaces aren't
declared.  So for exporting let's check the same macros that control
declaring them.

libstdc++-v3/ChangeLog:

	* src/c++23/std.cc.in: Add more #if.
2025-12-06 18:31:44 +08:00
Jakub Jelinek
c57188ef0c attribs: Use attribute_value_equal in decl_attributes
This is another thing discussed in the 1/9 Reflection thread,
also not dependent on reflection.

decl_attributes calls simple_cst_equal on TREE_VALUEs of the
current and preexisting attributes, but that is just a small
part of how attribute values should be compared.

The following patch fixes that.

2025-12-06  Jakub Jelinek  <jakub@redhat.com>

	* attribs.cc (decl_attributes): Use attribute_value_equal to
	compare attribute values instead of simple_cst_equal.
2025-12-06 11:08:05 +01:00
Jakub Jelinek
3b7e865779 c++: is_late_template_attribute and tsubst_attribute fixes
This has been discussed in the 1/9 Reflection thread, but doesn't depend on
reglection in any way.
cp_parser_std_attribute calls lookup_attribute_spec as:
    const attribute_spec *as
      = lookup_attribute_spec (TREE_PURPOSE (attribute));
so with TREE_LIST where TREE_VALUE is attribute name and TREE_PURPOSE
attribute ns.  Similarly c_parser_std_attribute.  And for
attribute_takes_identifier_p those do:
    else if (attr_ns == gnu_identifier
             && attribute_takes_identifier_p (attr_id))
and
        bool takes_identifier
          = (ns != NULL_TREE
             && strcmp (IDENTIFIER_POINTER (ns), "gnu") == 0
             && attribute_takes_identifier_p (name));
when handling std attributes (for GNU attributes they just call those
with the IDENTIFIER_NODE name.
is_late_template_attribute and tsubst_attribute pass to these functions
just get_attribute_name though, so handle attributes in all namespaces
as GNU attributes only, which means that lookup_attribute_spec can
return NULL or find a different attribute if it is not from gnu:: or
say standard attribute mapped to gnu::, or attribute_takes_identifier_p
can return true even for attributes for which it shouldn't.

I thought about changing attribute_takes_identifier_p to take optionally
TREE_LIST, but that would mean handling it in the target hooks too and
they only care about GNU attributes right now, so given the above
parser.cc/c-parser.cc snippets, the following patch just follow
what they do.

2025-12-06  Jakub Jelinek  <jakub@redhat.com>

	* decl2.cc (is_late_template_attribute): Call lookup_attribute_spec
	on TREE_PURPOSE (attr) rather than name.  Only call
	attribute_takes_identifier_p if get_attribute_namespace (attr) is
	gnu_identifier.
	* pt.cc (tsubst_attribute): Only call attribute_takes_identifier_p
	if get_attribute_namespace (t) is gnu_identifier.
2025-12-06 11:07:18 +01:00
Paul Thomas
78c787bbe5 Fortran: [PDT] Failure with local allocatable PDT array [PR122693]
2025-12-06  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
	PR fortran/122693
	* array.cc (gfc_match_array_constructor): Stash and restore
	gfc_current_ns after the call to 'gfc_match_type_spec'.

gcc/testsuite
	PR fortran/122693
	* gfortran.dg/pdt_75.f03: New test.
2025-12-06 08:05:41 +00:00
Paul Thomas
52154ade96 Fortran: [PDT] Mismatched types with same name in assignment [PR122670]
2025-12-06  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
	PR fortran/122670
	* decl.cc (gfc_get_pdt_instance): Ensure that, in an interface
	body, PDT instances imported implicitly if the template has
	been explicitly imported.
	* module.cc (read_module): If a PDT template appears in a use
	only statement, implicitly add the instances as well.

gcc/testsuite
	PR fortran/122670
	* gfortran.dg/pdt_74.f03: New test.
2025-12-06 08:00:21 +00:00
Paul Thomas
e48b0e8c04 Fortran: ALLOCATE with array-valued MOLD expression fails [PR122669]
2025-12-06  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
	PR fortran/122669
	* resolve.cc (resolve_allocate_deallocate): Mold expressions
	with an array reference and a constant size must be resolved
	for each allocate object.

gcc/testsuite
	PR fortran/122669
	* gfortran.dg/pdt_73.f03: New test.
2025-12-06 07:54:39 +00:00
Paul Thomas
8387f1160d Fortran: [PDT] Unresolved component and generic binding [PR122578]
2025-12-06  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
	PR fortran/122578
	* primary.cc (gfc_match_varspec): Try to resolve a typebound
	generic procedure selector expression to provide the associate
	name with a type. Also, resolve component calls. In both cases,
	make a copy of the selector expression to guard against changes
	made by gfc_resolve_expr.

gcc/testsuite
	PR fortran/122578
	* gfortran.dg/pdt_72.f03: New test.
2025-12-06 07:51:21 +00:00
Mark Zhuang
bc46466ec7 [PATCH] prepare-commit-msg: Add compatibility check for --default-prefix option
From: Mark Zhuang <mark.zhuang@spacemit.com>

The previous commit added --default-prefix to handle non-default git
prefix configurations, but this option is not available in older git
versions. This patch adds a compatibility check.

contrib/ChangeLog:

	* prepare-commit-msg: check --default-prefix
2025-12-05 22:16:25 -07:00
Dimitar Dimitrov
528df313f6 [PATCH v3] rtl-optimization: Fix BB edge ordering [PR122675]
Starting with r16-4438-ga93f80feeef744, the edge sorting order was
switched to lowest execution frequency first.  But the "bbro"
optimization pass chooses the first edge as a fallthrough.  Thus the
most unlikely branches were optimized to fallthroughs.

Fix by restoring the sorting order prior to r16-4438-ga93f80feeef744.
Now the branches most likely to be executed are picked as fallthroughs.

There are no regressions for C and C++ on x86_64-pc-linux-gnu.

The new tests fail for the respective targets without this patch, and
pass with it.

	PR rtl-optimization/122675

gcc/ChangeLog:

	* bb-reorder.cc (edge_order): Fix BB edge ordering to be
	descending.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/pr122675-1.c: New test.
	* gcc.target/i386/pr122675-1.c: New test.
	* gcc.target/riscv/pr122675-1.c: New test.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2025-12-05 21:57:58 -07:00
Patrick Palka
83aab2f736 libstdc++: Use deducing this in std::bind when available [PR80564]
Implement the forwarding performed by std::bind via deducing this when
available, instead of needing 4 operator() overloads.  Using deducing
this here is more complicated than in other standard call wrappers
because std::bind is not really "perfect forwarding": it doesn't
consider value category, and along with const-ness it also forwards
volatile-ness (until C++20).

The old implementation suffers from the same problem that other
pre-C++23 SFINAE-friendly call wrappers have which is solved by using
deducing this (see p5.5 of the deducing this paper P0847R7).

	PR libstdc++/80564

libstdc++-v3/ChangeLog:

	* include/std/functional (__cv_like): New.
	(_Bind::_Res_type): Don't define when not needed.
	(_Bind::__dependent): Likewise.
	(_Bind::_Res_type_cv): Likewise.
	(_Bind::operator()) [_GLIBCXX_EXPLICIT_THIS_PARAMETER]:
	Define as two instead of four overloads using deducing
	this.
	* testsuite/20_util/bind/cv_quals_2.cc: Ignore SFINAE
	diagnostics inside headers.
	* testsuite/20_util/bind/ref_neg.cc: Likewise.
	* testsuite/20_util/bind/80564.cc: New test.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
2025-12-05 21:09:34 -05:00
Jose E. Marchesi
a1d895cd7a a68: handle intTI_type_node in a68_type_for_size
gcc/algol68/ChangeLog

	PR algol68/123007
	* a68-lang.cc (a68_type_for_size): Handle intTI_type_node.
2025-12-06 02:49:22 +01:00
Jonathan Wakely
7a2d141876 libstdc++: std::atomic should use std::addressof
libstdc++-v3/ChangeLog:

	* include/bits/atomic_wait.h (__detail::__atomic_eq): Use
	std::addressof instead of &.
	* include/std/atomic (atomic::wait, atomic::notify_one)
	(atomic::notify_all): Likewise.

Reviewed-by: Patrick Palka <ppalka@redhat.com>
2025-12-06 00:28:43 +00:00
GCC Administrator
2e61e52e88 Daily bump. 2025-12-06 00:16:32 +00:00
Jakub Jelinek
2d34fa5ec1 testsuite: Small tweaks for pr99782-1.c test [PR99782]
2025-12-06  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/99782
	* gcc.dg/torture/pr99782-1.c: Fix typo, dg-compile -> dg-do compile.
	Use int128 effective target directly on that directive.  Move PR
	comment first.
2025-12-06 01:09:24 +01:00
Andrew Pinski
cb9744aa04 testsuite: Fix pr99782-1.c for targets that don't support int128
When I wrote this testcase I forgot to check if the target
supports __int128. This adds the simple check.

Pushed as obvious after testing the testcase.

gcc/testsuite/ChangeLog:

	* gcc.dg/torture/pr99782-1.c: Require intt128 target.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2025-12-05 13:32:46 -08:00
Vladimir N. Makarov
2b83c489ca [PR122215, IRA]: Fix undefined behaviour of improve_allocation
Register filters are used in one loop of improve_allocation to ignore some
hard regs for cost calculation but it is missed in the subsequent loop
using the costs.  This results in usage of random (undefined) register costs
and in sporadic code generation for riscv32 which uses the filters.

gcc/ChangeLog:

	PR rtl-optimization/122215
	* ira-color.cc (improve_allocation): Use register filter for all
	loop on hard regs.

gcc/testsuite/ChangeLog:

	PR rtl-optimization/122215
	* gcc.target/riscv/pr122215.c: New.
	* lib/target-supports.exp (check_effective_target_valgrind): New.
2025-12-05 14:29:08 -05:00
Harald Anlauf
ee9ded1924 Fortran: associate to a contiguous pointer or target [PR122977]
PR fortran/122977

gcc/fortran/ChangeLog:

	* expr.cc (gfc_is_simply_contiguous): For an associate variable
	check whether the associate target is contiguous.
	* resolve.cc (resolve_symbol): Skip array type check for an
	associate variable when	the target has the contiguous attribute.

gcc/testsuite/ChangeLog:

	* gfortran.dg/contiguous_16.f90: New test.
2025-12-05 19:49:14 +01:00
Patrick Palka
d1ac432c5a libstdc++: Implement rest of P2655R3 common_reference of reference_wrapper
PR libstdc++/120446

libstdc++-v3/ChangeLog:

	* include/bits/refwrap.h (__detail::__is_ref_wrapper):
	Define as per P2655R3 for C++20.
	(__detail::__ref_wrap_common_reference_exists_with): Likewise.
	(basic_common_reference): Define partial specializations using
	the above as per P2655R3 for C++20.
	* include/bits/version.def (common_reference_wrapper): New.
	* include/bits/version.h: Regenerate.
	* include/std/functional (__glibcxx_want_common_reference_wrapper):
	Define.
	* testsuite/20_util/reference_wrapper/p2655r3.cc: New test.

Co-authored-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
2025-12-05 13:43:40 -05:00
Patrick Palka
a9fd651fbb libstdc++: Implement P2655R3 changes to common_reference bullet 1
We implement this paper as a DR against C++20 (as do MSVC and libc++).

	PR libstdc++/120446

libstdc++-v3/ChangeLog:

	* include/bits/version.def (common_reference): New.
	* include/bits/version.h: Regenerate.
	* include/std/type_traits (__glibcxx_want_common_reference):
	Define.
	(__common_reference_impl<T1, T2, 1>): Add pointer convertibility
	constraints as per P2655R3.
	* testsuite/20_util/common_reference/p2655r3.cc: New test.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
2025-12-05 13:43:29 -05:00
Patrick Palka
cbdbbdd1fc libstdc++: Consolidate bullet 1 __common_reference_impl partial specs
... and in passing use requires-clauses instead of void_t based SFINAE.
This is a non-functional change that'll simplify implementing the
P2655R3 change to common_reference.

	PR c++/120446

libstdc++-v3/ChangeLog:

	* include/std/type_traits (__common_reference_impl): Rewrite
	partial specializations to use requires-clause instead of
	an additional void_t template parameter.  Consolidate the
	partial specializations corresponding to bullet 1.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
2025-12-05 13:43:26 -05:00
Patrick Palka
5d5eeb3709 libstdc++/testsuite: Fix malformed dg-error directive
libstdc++-v3/ChangeLog:

	* testsuite/20_util/function_objects/bind_front/111327.cc:
	Add missing space before } ending a dg-error directive.
2025-12-05 12:48:44 -05:00
Patrick Palka
5a2a527b26 libstdc++: Use deducing this in range adaptors even in C++20 [PR111550]
Use deducing this to implement perfect forwarding even in C++20 mode
by using the _GLIBCXX_EXPLICIT_THIS_PARAMETER internal FTM instead of
the standard __cpp_explicit_this_parameter.  This fixes the original
testcase from this PR even in C++20 mode.

	PR libstdc++/111550

libstdc++-v3/ChangeLog:

	* include/std/ranges (views::__adaptor::_Partial::operator())
	[_GLIBCXX_EXPLICIT_THIS_PARAMETER]: Also use deducing this
	in C++20 mode when possible.
	(views::__adaptor::_Pipe::Operator())
	[_GLIBCXX_EXPLICIT_THIS_PARAMETER]: Likewise.
	* testsuite/std/ranges/adaptors/take.cc (test07): New test.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
2025-12-05 12:16:30 -05:00
Patrick Palka
b212314667 libstdc++: Use deducing this in std::bind_front even in C++20 [PR111327]
PR libstdc++/111327

libstdc++-v3/ChangeLog:

	* include/bits/binders.h (_Binder::operator())
	[_GLIBCXX_EXPLICIT_THIS_PARAMETER]: Also use deducing this in
	C++20 mode when possible.
	* testsuite/20_util/function_objects/bind_front/111327.cc:
	Expect error inside header even in C++20 mode.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
2025-12-05 12:15:08 -05:00
Patrick Palka
756e32a160 libstdc++: Use deducing this in std::not_fn when available [PR111327]
Implement the perfect forwarding required by std::not_fn using deducing
this when available, instead of needing 8 operator() overloads.  This
also fixes Jiang An's test from this PR which would be messy to fix in
the old implementation.

	PR libstdc++/111327

libstdc++-v3/ChangeLog:

	* include/std/functional (_Not_fn::operator())
	[_GLIBCXX_EXPLICIT_THIS_PARAMETER]: Define as a single
	overload using deducing this.
	* testsuite/20_util/function_objects/not_fn/111327.cc: Extend test.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
2025-12-05 12:14:23 -05:00
Patrick Palka
101f968476 libstdc++: Introduce _GLIBCXX_EXPLICIT_THIS_PARAMETER internal FTM
This FTM is like __cpp_explicit_this_parameter but is also defined
in earlier C++ modes if deducing this is supported as an extension
by the compiler.  Currently only GCC supports this, Clang doesn't.

libstdc++-v3/ChangeLog:

	* include/bits/c++config (_GLIBCXX_EXPLICIT_THIS_PARAMETER):
	New.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
2025-12-05 12:14:18 -05:00
Richard Earnshaw
c48b55fa77 arm: avoid invalid shift in arm_canonicalize_comparison [PR122999]
There was UB in arm_canonicalize_comparison if it is called with
both operands of type VOIDmode.  Avoid this by first handling
floating-point types, then returning if we are left with anything
other than an integer mode.  For belt-and-braces also check that
the mode does not require a mask larger than HOST_WIDE_INT.

gcc/ChangeLog:

	PR target/122999
	* config/arm/arm.cc (arm_canonicalize_comparison): Defer
	initializing maxval until we know we are dealing with an
	integer mode.
2025-12-05 17:00:56 +00:00
Tobias Burnus
1c78abfd19 gomp/dyn_groupprivate-1.f90: Fix scan-tree-dump-times regex
gcc/testsuite/ChangeLog:

	* gfortran.dg/gomp/dyn_groupprivate-1.f90: Fix
	scan-tree-dump-times regexp to avoid hard-coded 'D.4680'.
2025-12-05 14:55:27 +01:00
Richard Biener
27210c145b Fix vect_need_peeling_or_partial_vectors_p wrt peeling for gaps
The code assuming that peeling for gaps can be elided by means of
knowing niters and prologue peeling is wrong.  Peeling for gaps
means we need an epilog.

	* tree-vect-loop.cc (vect_need_peeling_or_partial_vectors_p):
	When peeling for gaps we always need an epilog.
2025-12-05 13:29:41 +01:00
Richard Biener
7dd39924c9 tree-optimization/120939 - remove uninitialized use of LOOP_VINFO_COST_MODEL_THRESHOLD
The following removes an optimization that wrongly triggers right now
because it accesses LOOP_VINFO_COST_MODEL_THRESHOLD which might not be
computed yet and uses guessed likely max stmt executions.

It also refactors the code to make the default conservative.

	PR tree-optimization/120939
	* tree-vect-loop.cc (vect_need_peeling_or_partial_vectors_p):
	Remove eliding an epilogue based on not computed
	LOOP_VINFO_COST_MODEL_THRESHOLD and estimated max stmt executions.

	* gcc.dg/torture/pr113026-1.c: Skip when -ftracer.
2025-12-05 13:29:40 +01:00
Richard Biener
973a32e1c6 Make gcc.dg/vect/vect-pr123002.c trigger on unfixed trunk
The following avoids VRP to access the constant initializer.

	PR tree-optimization/123002
	* gcc.dg/vect/vect-pr123002.c: Make global data non-const
	and non-static.
2025-12-05 13:26:56 +01:00
Javier Miranda
a99a56a091 ada: Unsigned_Base_Range aspect (part 6)
Revert patch for Is_Modular_Integer_Type and Is_Signed_Integer_Type;
add new synthesized predicates Has_Modular_Operations and
Has_Overflow_Operations, and adjust the frontend sources
to rely on them.

gcc/ada/ChangeLog:

	* einfo.ads (Has_Unsigned_Base_Range_Aspect): Update documentation.
	(Has_Modular_Operations): New synthesized predicate.
	(Has_Overflow_Operations): New synthesized predicate.
	* einfo-utils.ads (Has_Modular_Operations): New function.
	(Has_Overflow_Operations): New function.
	* einfo-utils.adb (Is_Modular_Integer_Type): Undo previous patch.
	(Is_Signed_Integer_Type): Undo previous patch.
	(Has_Modular_Operations): New function.
	(Has_Overflow_Operations): New function.
	* checks.adb (Determine_Range): Replace selected occurrences of calls to
	Is_Modular_Integer_Type by calls to Has_Modular_Operations, and calls to
	Is_Signed_Integer_Type by calls to Has Overflow_Operations.
	(Enable_Range_Check): Ditto.
	(Insert_Valid_Check): Ditto.
	* exp_aggr.adb (Others_Check): Ditto.
	* exp_attr.adb (Expand_N_Attribute_Reference [Attribute_Pred,
	Attribute_Succ]): Ditto.
	* exp_ch4.adb (Expand_Compare_Minimize_Eliminate_Overflow): Ditto.
	(Size_In_Storage_Elements): Ditto.
	(Expand_N_Op_Abs): Ditto.
	(Expand_N_Op_Expon): Ditto.
	(Expand_N_Op_Minus): Ditto.
	(Expand_N_Op_Multiply): Ditto.
	(Expand_N_Op_Subtract): Ditto.
	* freeze.adb (Freeze_Entity): Ditto.
	* sem_aggr.adb (Report_Null_Array_Constraint_Error): Ditto plus
	report specific error for index with unsigned_base_range aspect.
	* sem_attr.adb (Check_Modular_Integer_Type): Ditto.
	(Analyze_Attribute [Attribute_Pred, Attribute_Succ, Attribute_
	Range_Length, Attribute_Small, Attribute_Reduce]): Ditto.
	* sem_ch12.adb (Instantiate_Type): Ditto.
	(Validate_Formal_Type_Default): Ditto.
	* sem_ch13.adb (Valid_Empty): Ditto.
	* sem_ch2.adb (Analyze_Integer_Literal): Ditto.
	* sem_ch3.adb (Unsigned_Base_Range_Type_Declaration): Set attribute
	Has_Unsigned_Base_Range_Aspect on the implicit base, and set Etype
	of its first subtype E_Modular_Integer_Subtype.
	* sem_ch4.adb (Analyze_Call): Ditto.
	* sem_eval.adb (Check_Non_Static_Context_For_Overflow): Ditto.
	(Eval_Arithmetic_Op): Ditto.
	(Eval_Integer_Literal): Ditto.
	(Eval_Logical_Op): Ditto.
	(Eval_Op_Expon): Ditto.
	(Eval_Op_Not): Ditto.
	(Eval_Unary_Op): Ditto.
	(Fold_Shift): Ditto.
	(Test_Expression_Is_Foldable): Ditto.
	* sem_intr.adb (Check_Shift): Ditto.
	* sem_prag.adb (Analyze_Pragma [Pragma_Unsigned_Base_Range]): Add
	assertion.
	* sem_res.adb (Resolve_Logical_Op): Ditto.
	(Resolve_Unary_Op): Ditto.
	(Set_String_Literal_Subtype): Ditto.
	* sem_type.adb (Covers): Ditto.
	(Specific_Type): Ditto.
	(Valid_Boolean_Arg): Ditto.
	* sem_util.adb (Wrong_Type): Ditto
	* style.adb (Check_Boolean_Operator): Ditto.
2025-12-05 13:22:54 +01:00
Ronan Desplanques
b224a5f39c ada: Improve readability of table in reference manual
This patch changes a table in the reference manual so that the Ada code
inside is properly highlighted and uses the usual casing conventions.

gcc/ada/ChangeLog:

	* doc/gnat_rm/representation_clauses_and_pragmas.rst: Improve table.
	* gnat_rm.texi: Regenerate.
	* gnat_ugn.texi: Regenerate.
2025-12-05 13:22:53 +01:00
Viljar Indus
b85d7e3eec ada: Fix false positive error for classwide containers
Get_Cursor_Type fails if a classwide container type
is passed to it as it cannot correctly identify the
cursor type since it is expecting the iteration functions
to have a container argument with a classwide container type.

gcc/ada/ChangeLog:

	* sem_util.adb (Get_Cursor_Type): use the
	specific type for classwide container checks.
2025-12-05 13:22:53 +01:00
Eric Botcazou
b6bfc77fe5 ada: Fix problematic aggregate with box notation
It runs afoul of the pragma Initialize_Scalars + -gnatVa combination.

gcc/ada/ChangeLog:

	* sem_ch12.adb (Remove_Parent): Only set the Is_Transient component
	of the local scope stack entry.
2025-12-05 13:22:53 +01:00
Marc Poulhiès
fb0daefc42 ada: Adjust documentation on floating-point overflow handling
The description of the floating-point overflow behavior is already
documented in other sections: remove the duplication.
This removal also removes confusing/wrong informations

gcc/ada/ChangeLog:

	* doc/gnat_ugn/building_executable_programs_with_gnat.rst
	(-gnato??): Remove redundant/confusing doc on floating-point
	overflow.
	* gnat_ugn.texi: Regenerate.
2025-12-05 13:22:52 +01:00
Tonu Naks
58ccdca74a ada: Ensure that file is not locked on windows when opened RO
gcc/ada/ChangeLog:

	* adaint.c: use the _tsopen macro when opening RO file
2025-12-05 13:22:52 +01:00
Denis Mazzucato
7fd14b6c9d ada: Fix reducer selection when resolving 'Reduce attribute
This patch ensures that, during the 'Reduce attribute resolution phase, the
selected reducer subprogram exists, is not ambiguous, and has the proper reducer
profile. Before we could have selected a wrong interpretation.

gcc/ada/ChangeLog:

	* sem_attr.adb
	(Analyze_Attribute): Set the type of the attribute expression only when
	not ambiguous (it will later be resolved correctly). Emit an error in
	case the type is limited.
	(Resolve_Attribute): Emit an error if the reducer has no entity.
	(Get_Value_Subtype): Try to resolve the Value_Subtype of the aggregate
	expression, and if it succeeds, set the candidate reducer subprogram.
	(Is_Reducer_Subprogram): Check whether the selected candidate has a
	proper reducer profile.
	(Make_Array_Type): Return simple array type to resolve the array
	aggregate against it.
	(Resolve_Attribute): Reimplement the resolution of Reduce attribute,
	including its prefix.
	* sem_res.adb (Resolve_Declare_Expression): Save and restore variables
	that may be hidden by the local declaration. Only setting the new
	entities is problematic when dealing with copied trees where the ref is
	lost (eg. when resolving array aggregates).
	* exp_attr.adb (Expand_N_Attribute_Reference): Remove tricks to resolve
	the reducer in case of faulty resolution as not needed anymore.

gcc/testsuite/ChangeLog:

	* gnat.dg/reduce1.adb: Adjust expected error message.
2025-12-05 13:22:52 +01:00
Richard Biener
1da0e5c140 Move even/odd validity check from supportable_widening_operation to caller
The following moves the incomplete validity check to use
WIDEN_MULT_{EVEN,ODD} to the caller of supportable_widening_operation
where we have access to more (but not enough) information.  I have
made the test conservative enough I hope.  For the testcase what was
broken is that it uses a SLP reduction where lane-swizzling isn't
valid.

	PR tree-optimization/123002
	* tree-vectorizer.h (supportable_widening_operation): Remove
	vinfo and stmt_info parameters, add flag to indicate whether
	the context would allow OP_{EVEN,ODD}.
	* tree-vect-patterns.cc (vect_recog_abd_pattern): Adjust
	and pass false.
	(vect_recog_widen_op_pattern): Likewise.
	(vect_recog_widen_abd_pattern): Likewise.
	* tree-vect-stmts.cc (vectorizable_conversion): Move
	even/odd validity check here, from supportable_widening_operation.
	Adjust it to be conservative.
	(supportable_widening_operation): Get flag whether even/odd
	is OK to use and remove then unused parameters and code.

	* gcc.dg/vect/vect-pr123002.c: New testcase.
2025-12-05 12:33:46 +01:00
Richard Biener
82305f37db Add clique/base parsing and dumping to the GIMPLE FE
The following adds clique/base on __MEM to the GIMPLE parser and
to -gimple dumping.

gcc/c/
	* gimple-parser.cc (c_parser_gimple_postfix_expression):
	Parse optional clique : base specifier on __MEM.

gcc/
	* tree-pretty-print.cc (dump_mem_ref): Dump clique : base
	specifier for MEM_REF and TARGET_MEM_REF when dumping
	GIMPLE format.

gcc/testsuite/
	* gcc.dg/gimplefe-58.c: New testcase.
2025-12-05 11:47:10 +01:00
Iain Sandoe
bdf293a112 Ada, Darwin: Implement OSLock for Darwin [PR115305].
The generic Posix code does not match the layout of the pthread entities
in the Darwin _pthread_types.h.  So, let's make a Darwin-specific version
and use it.

	PR ada/115305

gcc/ada/ChangeLog:

	* Makefile.rtl: Use s-oslock__darwin instead of the Posix version.
	* libgnat/s-oslock__darwin.ads: New file.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-12-05 10:31:05 +00:00
Tobias Burnus
a553c70e36 OpenMP: C/C++ parser support for dyn_groupprivate
Follow-up to the Fortran patch r16-5633-g26d41e245dbba3, which (besides
other changes) added parser support for the 'dyn_groupprivate' clause to
the target directive.
This commit adds now the parser support to C/C++ and moves the
not-yet-implemented 'sorry' to the early middle end.

gcc/c-family/ChangeLog:

	* c-omp.cc (c_omp_split_clauses): Handle
	OMP_CLAUSE_DYN_GROUPPRIVATE, sort target clauses
	alphabetically.
	* c-pragma.h (enum pragma_omp_clause): Add
	PRAGMA_OMP_CLAUSE_DYN_GROUPPRIVATE.

gcc/c/ChangeLog:

	* c-parser.cc (c_parser_omp_clause_dyn_groupprivate): New.
	(OMP_TARGET_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_DYN_GROUPPRIVATE;
	sort clauses alphabetically.
	(c_parser_omp_clause_name, c_parser_omp_all_clauses):
	Handle 'dyn_groupprivate' clause.
	* c-typeck.cc (c_finish_omp_clauses): Likewise.

gcc/cp/ChangeLog:

	* pt.cc (tsubst_omp_clauses): Handle OMP_CLAUSE_DYN_GROUPPRIVATE.
	* semantics.cc (finish_omp_clauses): Likewise.
	* parser.cc (cp_parser_omp_clause_dyn_groupprivate): New.
	(cp_parser_omp_clause_name, cp_parser_omp_all_clauses):
	Handle 'dyn_groupprivate' clause.
	(OMP_TARGET_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_DYN_GROUPPRIVATE;
	sort clauses alphabetically.

gcc/fortran/ChangeLog:

	* openmp.cc (resolve_omp_clauses): Permit zero with
	DYN_GROUPPRIVATE clause.
	* trans-openmp.cc (fallback): Generate TREE code
	for DYN_GROUPPRIVATE and remove 'sorry'.

gcc/ChangeLog:

	* gimplify.cc (gimplify_scan_omp_clauses): Handle
	OMP_CLAUSE_DYN_GROUPPRIVATE by printing 'sorry, unimplemented'.
	* tree-core.h (enum omp_clause_code): Add OMP_CLAUSE_DYN_GROUPPRIVATE.
	(enum omp_clause_fallback_kind): New.
	(struct tree_omp_clause): Add fallback_kind union member.
	* tree-nested.cc (convert_nonlocal_omp_clauses,
	convert_local_omp_clauses): Handle OMP_CLAUSE_DYN_GROUPPRIVATE.
	* tree.cc (omp_clause_num_ops, omp_clause_code_name): Add
	OMP_CLAUSE_DYN_GROUPPRIVATE.
	* tree-pretty-print.cc (dump_omp_clause): Handle
	OMP_CLAUSE_DYN_GROUPPRIVATE.
	* tree.h (OMP_CLAUSE_DYN_GROUPPRIVATE_EXPR,
	OMP_CLAUSE_DYN_GROUPPRIVATE_KIND): New #define.

gcc/testsuite/ChangeLog:

	* gfortran.dg/gomp/dyn_groupprivate-1.f90: Add scan-dump test.
	* gfortran.dg/gomp/dyn_groupprivate-2.f90: Extend and update.
	* c-c++-common/gomp/dyn_groupprivate-1.c: New test.
	* c-c++-common/gomp/dyn_groupprivate-2.c: New test.
2025-12-05 09:08:06 +01:00