Commit Graph

225633 Commits

Author SHA1 Message Date
Jason Merrill
9783f6f2f6 c++/modules: #include <vector> -> import <bits/stdc++.h>
Since the standard library doesn't preclude an #include of a standard
library header from bringing in declarations from other headers, we can
translate an #include of any of the importable headers as an import of
<bits/stdc++.h>.

To reduce the amount of C++ standard knowledge encoded in libcpp, I extend
the translate_include callback to allow it to suggest an alternate header to
try translating.  It's a bit awkward to bounce back and forth, but this
seems like the right division of responsibilities.

libcpp/ChangeLog:

	* include/cpplib.h (struct cpp_callbacks): Replace 'path' parameter
	with file, angle_brackets, and alternate name.
	(cpp_get_name): Declare.
	* files.cc (cpp_get_name): New.
	(_cpp_stack_include, _cpp_post_stack_file, _cpp_stack_file)
	(_cpp_stack_translated_file): Refactor, try alternate file.

gcc/cp/ChangeLog:

	* module.cc (maybe_translate_include): Suggest <bits/stdc++.h>
	as an alternate for importable standard library headers.
	(importable_headers, is_importable_header): New.

gcc/ChangeLog:

	* doc/invoke.texi (C++ Modules): Remove standard library header
	units from missing pieces, mention importable header redirection.

gcc/testsuite/ChangeLog:

	* g++.dg/modules/compile-std1.C: Test <vector> translation.
2025-12-10 23:11:26 +08:00
Jason Merrill
23d71494fe c++: clean up gcms from compile-std1.C
I noticed that the .gcms from compile-std1.C were sticking around and
confusing other tests; this patch enhances dg-module-cmi to understand
<header> and adds the appropriate directives to the test.

gcc/testsuite/ChangeLog:

	* g++.dg/modules/compile-std1.C: Add dg-module-cmi lines.
	* g++.dg/modules/modules.exp (host_header_path): New.
	(munge_cmi): Factor out...
	(dg-module-cmi): ...from here.
2025-12-10 22:27:28 +08:00
Robin Dapp
9748d369e2 RISC-V: Move pr123074.C to g++.target.
Andrew noticed that I added a c++ file to the wrong dir.  This patch
corrects it.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/autovec/pr123074.C: Move to...
	* g++.target/riscv/rvv/autovec/pr123074.C: ...here.
	* gcc.target/riscv/rvv/rvv.exp: Remove 'C'.
2025-12-10 11:03:57 +01:00
Rainer Orth
4f820a250d libsanitizer: Update LOCAL_PATCHES
This patch updates LOCAL_PATCHES for

commit 203d4dd09b
Author: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Date:   Wed Dec 10 09:24:53 2025 +0100

    libsanitizer: Restore local sanitizer_redefine_builtins.h patch

2025-12-10  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	libsanitizer:
	* LOCAL_PATCHES: Update.
2025-12-10 09:33:36 +01:00
Rainer Orth
203d4dd09b libsanitizer: Restore local sanitizer_redefine_builtins.h patch
The recent libsanitizer update broke the Solaris/SPARC build with the
native assembler: many files don't compile any longer like

/usr/bin/as: "/var/tmp//ccYsT60a.s", line 5: error: unknown opcode ".set"
/usr/bin/as: "/var/tmp//ccYsT60a.s", line 5: error: statement syntax
/usr/bin/as: "/var/tmp//ccYsT60a.s", line 6: error: unknown opcode ".set"
/usr/bin/as: "/var/tmp//ccYsT60a.s", line 6: error: statement syntax
/usr/bin/as: "/var/tmp//ccYsT60a.s", line 7: error: unknown opcode ".set"
/usr/bin/as: "/var/tmp//ccYsT60a.s", line 7: error: statement syntax

This happens because sanitizer_common/sanitizer_redefine_builtins.h lost
a local patch that guards use of .set in asm by HAVE_AS_SYM_ASSIGN.
This patch restores that patch.

Although the Darwin assembler accepts .set (thus HAVE_AS_SYM_ASSIGN is
defined), the __APPLE__ guard is kept to guard against the link failures
that prompted its upstreadm addition in LLVM commit

commit cfdbbb8fcc62f75dcf0b251dfab63353f3921227
Author: Dan Blackwell <dan_blackwell@apple.com>
Date:   Fri Aug 15 09:13:26 2025 +0100

    [sanitizer_common] Disable sanitizer_redefine_builtins on Apple platforms (#153381)

even though they didn't happen in the GCC build.

It also keeps the _AIX guard due to LLVM commit

commit d7c6cad744bc7ed28535dc6f75629902eda559ea
Author: Jake Egan <Jake.egan@ibm.com>
Date:   Wed Jun 11 20:22:15 2025 -0400

    [sanitizer_common] Implement interception on AIX (#138606)

Bootstrapped without regressions on sparc-sun-solaris2.11 with gas and
as, i386-pc-solaris2.11, x86_64-pc-linux-gnu, and
x86_64-apple-darwin25.1.0.
2025-12-10 09:24:53 +01:00
Rainer Orth
89889bff20 Fix PID_TYPE on 32-bit Solaris
The pid_t type on 32-bit Solaris differs from gcc's builtin.

<sys/types.h> has

typedef int	pid_t;			/* process id type	*/
typedef	long	pid_t;			/* (historical version) */

while gcc/defaults.h uses

on all targets.

This patch fixes this by providing a Solaris definition.
g++.dg/lookup/extern-c-redecl3.C had to be adjusted accordingly.

Bootstrapped without regressions on i386-pc-solaris2.11,
sparc-sun-solaris2.11, and x86_64-pc-linux-gnu.

2025-11-17  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	gcc:
	* config/sol2.h (PID_TYPE): Define.
	* doc/tm.texi.in (Type Layout): Document PID_TYPE.
	* doc/tm.texi: Regenerate.

	gcc/testsuite:
	* g++.dg/lookup/extern-c-redecl3.C (pid_t): Define.
	Use it for fork return type.
	terms of __builtin_fork.
	* g++.dg/pid_t-1.C: New test.
	* gcc.dg/pid_t-1.c: Likewise.
2025-12-10 09:05:55 +01:00
GCC Administrator
3b3e153da5 Daily bump. 2025-12-10 00:16:32 +00:00
John Ericson
9947930b7a libgcc: Dont use TARGET_SYSTEM_ROOT from gcc
Following Andrew Pinski's suggestions in
https://gcc.gnu.org/pipermail/gcc-patches/2025-July/689683.html, just
use the output of:

   $(CC) -print-sysroot

It is just used in one spot, in an AIX code-path. I just made (within
make) a shell variable to use instead.

I don't have AIX on-hand to test this, however.

gcc/ChangeLog:

	* Makefile.in: No longer include TARGET_SYSTEM_ROOT in
	libgcc.mvars.

libgcc/ChangeLog:

	* config/rs6000/t-slibgcc-aix: Instead of using a
	TARGET_SYSTEM_ROOT make variable, just define a shell variable
	as part of the rule and use that.

Suggested-by: Andrew Pinski <quic_apinski@quicinc.com>
Signed-off-by: John Ericson <git@JohnEricson.me>
2025-12-09 22:06:52 +00:00
John Ericson
77144dd3b6 Move NO_PIE_CFLAGS logic from gcc to libgcc
My goal is to be able to build libgcc cleanly in isolation --- today one
needs to figure `make ...` misc things in the gcc subdir.

Following Andrew Pinski's suggestions in
https://gcc.gnu.org/pipermail/gcc-patches/2025-July/689683.html, this
commit moves the NO_PIE_CFLAGS logic.

gcc/ChangeLog:

	* Makefile.in:: Remove NO_PIE_CFLAGS logic, since it is now in
	libgcc.
	* configure: Regenerate.
	* configure.ac: Remove the enable_default_pie substitution, since
	libgcc now has its own logic.

libgcc/ChangeLog:

	* Makefile.in: Define NO_PIE_CFLAGS make variable via autoconf
	substitution.
	* configure: Regenerate.
	* configure.ac: New configure check to define NO_PIE_CFLAGS
	using the algorithm Andrew asked for in the linked mail.

Suggested-by: Andrew Pinski <quic_apinski@quicinc.com>
Signed-off-by: John Ericson <git@JohnEricson.me>
2025-12-09 22:06:51 +00:00
John Ericson
e5d853bbe9 Factor out thread model detection with new GCC_AC_THREAD_MODEL macro
This macro deduplicates the

    $CC -v 2>&1 | sed -n 's/^Thread model: //p'

check that was occurring in various runtime libs.

Additionally, as a bit of an Easter egg, this also allows overriding
what the compiler would return by setting the
`gcc_cv_target_thread_file` cache variable first. I admit that it is in
fact this Easter egg that led me to write the patch. The use-case for it
is for making multilib builds where the library sets do not all share
the same thread model easier. See also `THREAD_MODEL_SPEC` for more
about the varying thread models use-case.

Arguably one could could try to define on `THREAD_MODEL_SPEC` on more
platforms (besides e.g. AIX) but the ramifications of this are a bit
unclear. Setting `gcc_cv_target_thread_file` directly is a "low tech"
solution that will work for now for sure. Of course, since setting a
cache variable like this a hacky trick, I will not expect this to be at
all stable/guaranteed to work, going forward.

Thanks to Arsen who on IRC discussed these things with me, including in
particular making it a cache var not `--with-model` flag, to not
prematurely foster expectations that this is stable.

Suggested-by: Arsen Arsenović <arsen@aarsen.me>

config/ChangeLog:

	* gthr.m4: Create new GCC_AC_THREAD_MODEL macro

libatomic/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* configure.ac: Use GCC_AC_THREAD_MODEL instead of hand-rolled
	* testsuite/Makefile.in: Regenerate.

libgcc/ChangeLog:

	* configure: Regenerate.
	* configure.ac: Use GCC_AC_THREAD_MODEL instead of hand-rolled

libphobos/ChangeLog:

	* configure: Regenerate.
	* m4/druntime/os.m4: Use AC_MSG_ERROR, not private as_fn_error

libstdc++-v3/ChangeLog:

	* acinclude.m4: Use GCC_AC_THREAD_MODEL instead, via AC_REQUIRE
	* configure: Regenerate.
2025-12-09 22:06:48 +00:00
Jonathan Wakely
1dd44ebd5f libstdc++: Regenerate <bits/version.h>
Some pre-r16-4328-g71e95e871d62e4 comments sneaked back in with some
recent commits.

libstdc++-v3/ChangeLog:

	* include/bits/version.h: Regenerate.
2025-12-09 21:06:27 +00:00
Luc Grosheintz
e2026d74f6 libstdc++: Set __cpp_lib_submdspan to 202411.
The submdspan feature is complete and this commit sets the feature
testing macros accordingly. Also makes the feature testing macro
submdspan depend on constant_wrapper.

Also changes the value of the internal feature testing macro for padded
layouts to 202403.

libstdc++-v3/ChangeLog:

	* include/bits/version.def (padded_layouts): Set to 202403.
	(submdspan): Set to 202411 add dependency.
	* include/bits/version.h: Regenerate.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
2025-12-09 17:38:56 +01:00
Robin Dapp
87b1ac612a vect: Reset using_select_vl_p before starting over [PR123074].
In the PR we ICE accessing the loop lens in
vect_get_loop_variant_data_ptr_increment when building 510.parest.
This function only gets called when we use SELECT_VL for the loop
control, however during initialization of the loop lens partial
vectors, a prerequisite for SELECT_VL, was false while using_select_vl
was true.  We reset using_partial_vectors when restarting the analysis
after forcing single-lane SLP but don't reset using_select_vl.

This patch resets it as well.

	PR tree-optimization/123074

gcc/ChangeLog:

	* tree-vect-loop.cc: Reset LOOP_VINFO_USING_SELECT_VL_P.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/rvv.exp: Include *.C.
	* gcc.target/riscv/rvv/autovec/pr123074.C: New test.
2025-12-09 17:33:15 +01:00
Qing Zhao
cd4d3a14b2 c: ICE in gimplify_expr when counted_by for pointer is added [PR122982]
The first argument of the call to .ACCESS_WITH_SIZE includes
"c_maybe_const_expr" which should not be passed to gimplifier.

Before passing the expression as the first argument to the call to
.ACCESS_WITH_SIZE, c_fully_fold should be called on this expression.

	PR c/122982

gcc/c/ChangeLog:

	* c-typeck.cc (build_access_with_size_for_counted_by): Call
	c_fully_fold on the first parameter.

gcc/testsuite/ChangeLog:

	* gcc.dg/pointer-counted-by-pr122982.c: New test.
2025-12-09 16:15:45 +00:00
Luc Grosheintz
f5d72af36d libstdc++: Implement submdspan_mapping for layout_right_padded. [PR110352]
Implements submdspan for layout_right_padded as described in P3663.

	PR libstdc++/110352

libstdc++-v3/ChangeLog:

	* include/std/mdspan
	(__mdspan::_SubMdspanMapping<_LayoutSide::__right, true>): Define.
	(layout_right_padded::submdspan_mapping): New friend function.
	* testsuite/23_containers/mdspan/submdspan/selections/right_padded.cc:
	Instantiate tests for layout_right_padded.
	* testsuite/23_containers/mdspan/submdspan/submdspan_mapping.cc:
	Ditto.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
2025-12-09 17:12:58 +01:00
Luc Grosheintz
558ab7b638 libstdc++: Implement submdspan_mapping for layout_left_padded. [PR110352]
Implements submdspan for layout_left_padded as described in P3663.

	PR libstdc++/110352

libstdc++-v3/ChangeLog:

	* include/std/mdspan (__mdspan::__is_padded_mapping): Define.
	(__mdspan::_SubMdspanMapping): Add _Padded template parameter.
	(__mdspan::_SubMdspanMapping<_LayoutSide::__left, true>): Define.
	(__mdspan::__submdspan_mapping_impl): Updated _Trait alias.
	(layout_left_padded::submdspan_mapping): New friend method.
	* testsuite/23_containers/mdspan/layout_traits.h
	(LayoutTraits::layout_same_padded): New template type alias.
	* testsuite/23_containers/mdspan/submdspan/selections/left_padded.cc:
	Instantiate tests for layout_left_padded.
	* testsuite/23_containers/mdspan/submdspan/submdspan_mapping.cc:
	Ditto.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
2025-12-09 17:08:01 +01:00
Pan Li
0fcb1bd46a RISC-V: Add test for vec_duplicate + vmslt.vv combine with GR2VR cost 0, 1 and 15
Add asm dump check and run test for vec_duplicate + vmslt.vv
combine to vmslt.vx, with the GR2VR cost is 0, 2 and 15.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i16.c: Add asm check
	for vmslt.vx.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i32.c: Ditto.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i64.c: Ditto.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i8.c: Ditto.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i16.c: Ditto.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i32.c: Ditto.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i64.c: Ditto.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i8.c: Ditto.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i16.c: Ditto.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i32.c: Ditto.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i64.c: Ditto.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i8.c: Ditto.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h: Add test
	helper macros.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx_binary_data.h: Add test
	data for run test.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx_vmslt-run-1-i16.c: New test.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx_vmslt-run-1-i32.c: New test.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx_vmslt-run-1-i64.c: New test.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx_vmslt-run-1-i8.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
2025-12-09 22:41:03 +08:00
Pan Li
d1f755115b RISC-V: Combine vec_duplicate + vmslt.vv to vmslt.vx on GR2VR cost
This patch would like to combine the vec_duplicate + vmslt.wv to the
vmslt.vx.  From example as below code.  The related pattern will depend
on the cost of vec_duplicate from GR2VR.  Then the late-combine will
take action if the cost of GR2VR is zero, and reject the combination
if the GR2VR cost is greater than zero.

Assume we have asm code like below, GR2VR cost is 0.

Before this patch:
  11       beq a3,zero,.L8
  12       vsetvli a5,zero,e32,m1,ta,ma
  13       vmv.v.x v2,a2
  ...
  16   .L3:
  17       vsetvli a5,a3,e32,m1,ta,ma
  ...
  22       vmslt.vv v1,v2,v3
  ...
  25       bne a3,zero,.L3

After this patch:
  11       beq a3,zero,.L8
  ...
  14    .L3:
  15       vsetvli a5,a3,e32,m1,ta,ma
  ...
  20       vmslt.vx v1,a2,v3
  ...
  23       bne a3,zero,.L3

gcc/ChangeLog:

	* config/riscv/predicates.md: Append operator lt to
	the comparison_swappable_operator.
	* config/riscv/riscv-v.cc (get_swapped_cmp_rtx_code): Add
	swappable operator lt handing.

Signed-off-by: Pan Li <pan2.li@intel.com>
2025-12-09 22:41:03 +08:00
Richard Biener
3222a8493c target/121230 - x86 vector CTOR cost with 387 math
The following adjusts costing of vector construction from scalars for
FP modes which with 387 math can reside in FP regs which need spilling
to be reloaded to XMM.  I've played on the safe side with mixed
SSE/387 math.

	PR target/121230
	* config/i386/i386.cc (ix86_vector_costs::add_stmt_cost):
	With FP mode and 387 math cost spill/reload.

	* gcc.target/i386/pr121230.c: New testcase.
2025-12-09 15:08:57 +01:00
Richard Biener
bf81616040 testsuite/120167 - avoid IPA messing up with test
The following avoids cloning / IPA CP to mess up dump counting.

	PR testsuite/120167
libgomp/
	* testsuite/libgomp.graphite/force-parallel-1.c: Make parloop
	noipa.
2025-12-09 14:56:34 +01:00
Robin Dapp
0e95cfb22b RISC-V: Regenerate opt urls.
I forgot to regenerate the opt urls.  This patch makes up for it.

gcc/ChangeLog:

	* config/riscv/riscv.opt.urls:  Regenerate.
2025-12-09 14:24:20 +01:00
Luc Grosheintz
57d53be024 libstdc++: Implement submdspan_mapping for layout_stride. [PR110352]
Add submdspan_mapping for layout_stride as in P3663.

	PR libstdc++/110352

libstdc++-v3/ChangeLog:

	* include/std/mdspan (layout_stride::mapping::submdspan_mapping): New
	friend function.
	* testsuite/23_containers/mdspan/submdspan/selections/stride.cc:
	Instantiate tests for layout_stride.
	* testsuite/23_containers/mdspan/submdspan/submdspan_neg.cc:
	Ditto.
	* testsuite/23_containers/mdspan/submdspan/submdspan_mapping.cc:
	Add tests for layout_stride.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
2025-12-09 13:49:32 +01:00
Luc Grosheintz
c1c5ada671 libstdc++: Implement submdspan_mapping for layout_right. [PR110352]
Adds submdspan_mapping for layout_right as described in P3663.

	PR libstdc++/110352

libstdc++-v3/ChangeLog:

	* include/std/mdspan
	(__mdspan::_SubMdspanMapping<_LayoutSide::__right>): Define.
	(layout_right::mapping::submdspan_mapping): New friend function.
	* testsuite/23_containers/mdspan/submdspan/selections/right.cc:
	Instantiate tests for layout_right.
	* testsuite/23_containers/mdspan/submdspan/submdspan_mapping.cc:
	Ditto.
	* testsuite/23_containers/mdspan/submdspan/submdspan_neg.cc:
	Ditto.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
2025-12-09 13:46:36 +01:00
Luc Grosheintz
ead579d3c5 libstdc++: Implement submdspan and submdspan_mapping for layout_left. [PR110352]
Implements `submdspan` and `submdspan_mapping` for layout_left as
described in P3663 (Future proofing mdspan).

When computing the offset of the submdspan, one must check that the
lower bound of the slice range isn't out-of-range. There's a few
cases when the lower bound is never out-of-range:

  - full_extent and exts.extent(k) != 0,
  - collapsing slice types.

If those conditions are known to hold, no checks are generated.

Similarly, if all slices are full_extent, there's no need to call
mapping(0,...,0) for standardized mappings.

The implementation prepares to use the symmetry between layout_left and
layout_right and introduces concepts like a "layout side", i.e. left,
right or unknown/strided.

The tests use an iterator to replace nested for-loops. Which also makes
it easier to write the core test logic in a rank-independent manner.

	PR libstdc++/110352

libstdc++-v3/ChangeLog:

	* include/std/mdspan (__mdspan::__is_submdspan_mapping_result)
	(__mdspan::__submdspan_mapping_result, __mdspan::__fwd_prod)
	(__mdspan::__acceptable_slice_type, __mdspan::__slice_begin)
	(__mdspan::__suboffset, __mdspan::_LayoutSide, __mdspan::__mapping_side)
	(__mdspan::_StridesTrait, __mdspan::__substrides_generic)
	(__mdspan::__substrides_standardized, __mdspan::__substrides)
	(__mdspan::__is_unit_stride_slice, __mdspan::_SliceKind)
	(__mdspan::__make_slice_kind, __mdspan::__make_slice_kind_array)
	(__mdspan::__is_block, __mdspan::__padded_block_begin_generic)
	(__mdspan::__padded_block_begin, __mpdspan::_SubMdspanMapping)
	(__mdspan::__submdspan_mapping_impl): Define.
	(__mdspan::__dynamic_slice_extent, __mdspan::__static_slice_extent)
	(__mdspan::__subextents): Move earlier in the file.
	(layout_left::mapping::submdspan_mapping, __mdspan::__sliceable_mapping)
	(__mdspan::__submapping, submdspan): Define.
	* src/c++23/std.cc.in: Add submdspan.
	* testsuite/23_containers/mdspan/submdspan/generic.cc: New test.
	* testsuite/23_containers/mdspan/submdspan/selections/left.cc:
	Instantiate selection tests for layout_left.
	* testsuite/23_containers/mdspan/submdspan/selections/testcases.h: Generic
	tests different selections.
	* testsuite/23_containers/mdspan/submdspan/submdspan_mapping.cc: New test.
	* testsuite/23_containers/mdspan/submdspan/submdspan_neg.cc: New test.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
2025-12-09 13:44:06 +01:00
Nathaniel Shead
49c4b73283 Revert "c++: Non-inline temploid friends should still be COMDAT [PR122819]"
This reverts commit cf22e30f0c.
2025-12-09 23:35:32 +11:00
Luc Grosheintz
64d5e1eb97 libstdc++: Silence warning in mdspan.
Splitting the tests for submdspan triggered a compiler warning. This
commit changes the implementation of __dynamic_extents. In particular,
how the span is created. Functionally, the two are equivalent.

libstdc++-v3/ChangeLog:

	* include/std/mdspan (_ExtentsStorage::_M_dynamic_extents):
	Create span from pointer + size, not begin and end iterators.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
2025-12-09 13:26:08 +01:00
Andrew Stubbs
1cf9fda493 amdgcn: Adjust failure mode for gfx908 USM
Unified Shared Memory does not appear to work well on gfx908, which is why we
disabled xnack by default.  For this reason it makes sense to inform the user
as compile time, but this is causing trouble in the testsuite which assumes
that USM only fails at runtime.

This patch changes the gfx908 compile time message to a warning only (in case
some other target does this differently), and prevents the tests from
attempting to run in host-fallback mode (given that that is not what they are
trying to test).  It also changes the existing warning to only fire once.

The patch assumes that effective target "omp_usm" also implies self-maps.

gcc/ChangeLog:

	* config/gcn/gcn.cc (gcn_init_cumulative_args): Only warn once.
	Use "required" instead of "enabled" in the warning.
	* config/gcn/mkoffload.cc (process_asm): Warn, don't error.
	Use "required" instead of "on" in the warning.

libgomp/ChangeLog:

	* testsuite/lib/libgomp.exp (check_effective_target_omp_usm): New.
	* testsuite/libgomp.c++/target-std__array-concurrent-usm.C: Require
	working Unified Shared Memory to run the test.
	* testsuite/libgomp.c++/target-std__bitset-concurrent-usm.C: Likewise.
	* testsuite/libgomp.c++/target-std__deque-concurrent-usm.C: Likewise.
	* testsuite/libgomp.c++/target-std__forward_list-concurrent-usm.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__list-concurrent-usm.C: Likewise.
	* testsuite/libgomp.c++/target-std__map-concurrent-usm.C: Likewise.
	* testsuite/libgomp.c++/target-std__multimap-concurrent-usm.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__multiset-concurrent-usm.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__set-concurrent-usm.C: Likewise.
	* testsuite/libgomp.c++/target-std__span-concurrent-usm.C: Likewise.
	* testsuite/libgomp.c++/target-std__valarray-concurrent-usm.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__vector-concurrent-usm.C: Likewise.
	* testsuite/libgomp.c-c++-common/target-implicit-map-4.c: Likewise.
	* testsuite/libgomp.c-c++-common/target-link-3.c: Likewise.
	* testsuite/libgomp.c-c++-common/target-link-4.c: Likewise.
	* testsuite/libgomp.fortran/self_maps.f90: Likewise.
2025-12-09 11:29:40 +00:00
Jakub Jelinek
64b22d699e c: Reject vector type bit-fields [PR123018]
The following testcase ICEs since checking has been added to TYPE_PRECISION
macro.  check_bitfield_type_and_width is called when attributes haven't
been applied to the bit-field decl yet and so it still has INTEGER_TYPE
type, while at finish_struct time it already has VECTOR_TYPE.

The following patch just repeats the check_bitfield_type_and_width
in there.

Another option would be let handle_vector_size_attribute check for
bit-fields and error out there.

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

	PR c/123018
	* c-decl.cc (finish_struct): Diagnose bit-fields with vector type.

	* gcc.dg/pr123018.c: New test.
2025-12-09 10:22:26 +01:00
Robin Dapp
cee0a9dd27 fold: Elide MASK_LEN_LOAD/STORE with zero length [PR122635].
This patch adds zero-length handling to gimple_fold_partial_store and
gimple_fold_partial_load and unifies them into
gimple_fold_partial_load_store.

It introduces a new function partial_load_store_mask_state that
returns
 MASK_ALL_INACTIVE,
 MASK_ALL_ACTIVE, or
 MASK_UNKNOWN.

This result is used to either replace a load with its else value and
elide a store (when all inactive), turn the load/store into a regular
mem ref (all_active), or do nothing.

	PR tree-optimization/122635

gcc/ChangeLog:

	* gimple-fold.cc (enum mask_load_store_state): New enum.
	(gimple_fold_partial_load_store_mem_ref): Only fold
	"all active" loads/stores.
	(partial_load_store_mask_state): New function to compute mask
	state.
	(gimple_fold_partial_load): Remove.
	(gimple_fold_partial_load_store): New function.
	(gimple_fold_partial_store): Remove.
	(gimple_fold_call): Use new function.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/sve/pfalse-store.c: Expect more elided
	stores.
	* gcc.target/riscv/rvv/autovec/pr122635-1.c: New test.
	* gcc.target/riscv/rvv/autovec/pr122635-2.c: New test.
	* gcc.target/powerpc/p9-vec-length-epil-8.c: Expect two lxvl
	less.
2025-12-09 09:54:25 +01:00
Robin Dapp
a82f188449 optabs: Add else operand to LEN_LOAD.
When adding else operands to maskload and friends we didn't bother to do
the same for len_load (as we never use the residual elements anyway).
In order to simplify handling in gimple-fold, this patch adds the else
operand now.  Both, power and s390, zero out inactive elements.

gcc/ChangeLog:

	* config/rs6000/predicates.md (lxvl_else_operand): New
	predicate.
	* config/rs6000/vsx.md: Add else operand.
	* config/s390/predicates.md (vll_else_operand): New predicate.
	* config/s390/vector.md: Add else operand.
	* doc/md.texi: Document else operand.
	* internal-fn.cc (internal_fn_len_index): Adjust IFN_LEN_LOAD.
	(internal_fn_else_index): Add IFN_LEN_LOAD.
	* optabs-tree.cc (target_supports_len_load_store_p): Get else
	value for len_load.
	* tree-vect-stmts.cc (vectorizable_load): Pun the else value
	type.
2025-12-09 09:36:03 +01:00
Robin Dapp
7068b2e190 RISC-V: -mmax-vectorization.
This adds an -mmax-vectorization option to riscv, a verbatim copy from
aarch64.  It is an option for vector code analysis.  Internally it increases
scalar costs by a large factor so every vector approach will be
profitable.  As opposed to -fno-vect-cost-model, we will still compare
the vector approaches amongst each other, though.

In order to handle this argument without an '=' I needed to change the
parsing flow slightly.

gcc/ChangeLog:

	* config/riscv/riscv-target-attr.cc (riscv_target_attr_parser::handle_max_vect):
	New parser entry.
	(riscv_target_attr_parser::update_settings): Set max-vect
	option.
	(riscv_process_one_target_attr): Change null-arg handling.
	* config/riscv/riscv.cc (riscv_override_options_internal): Set
	max-vect option.
	* config/riscv/riscv.opt: Add -mmax-vectorization option.
	* doc/extend.texi: Document new option.
	* doc/invoke.texi: Ditto.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/autovec/max-vect-1.c: New test.
	* gcc.target/riscv/rvv/autovec/max-vect-2.c: New test.
2025-12-09 09:36:03 +01:00
Robin Dapp
195471cc07 RISC-V: Add more mode_idx attributes [PR123022].
Similar to 116149 we use the mode size of operand MODE_IDX but that
one could refer to a broadcast scalar.  Use operand 3 for scalar
broadcast patterns instead.

	PR target/123022

gcc/ChangeLog:

	* config/riscv/vector.md: Add mode_idx attribute.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/autovec/pr123022-2.c: New test.
	* gcc.target/riscv/rvv/autovec/pr123022.c: New test.
2025-12-09 09:36:03 +01:00
Robin Dapp
c139a4c918 RISC-V: Pragma target [PR115325].
This implements #pragma GCC target () for riscv.

All the functionality was already there so we only need to wrap existing
functions.

	PR target/115325

gcc/ChangeLog:

	* config/riscv/riscv-c.cc (riscv_pragma_target_parse): New
	function.
	(riscv_register_pragmas): Register riscv_pragma_target_parse.
	* config/riscv/riscv-protos.h (riscv_process_target_attr_for_pragma):
	Declare.
	(riscv_reset_previous_fndecl): Ditto.
	* config/riscv/riscv-target-attr.cc (riscv_process_target_attr_for_pragma):
	New function.
	* config/riscv/riscv.cc (riscv_reset_previous_fndecl): Reset.
	(riscv_option_save): New function.
	(riscv_option_print): Ditto.
	(riscv_get_interrupt_type): Adjust docs.
	(TARGET_OPTION_SAVE): Implement.
	(TARGET_OPTION_PRINT): Ditto.
	* doc/extend.texi: Document that riscv can do target pragams.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/pragma-target-1.c: New test.
	* gcc.target/riscv/pragma-target-2.c: New test.
2025-12-09 09:36:03 +01:00
Robin Dapp
0b129b8b36 RISC-V: Implement mask reduction.
This implements mask reductions by first counting the bits in the mask
(vcpop.m) and then comparing the resulting scalar against 0 or len.

gcc/ChangeLog:

	* config/riscv/autovec.md (reduc_sbool_and_scal_<mode>): New
	expander.
	(reduc_sbool_ior_scal_<mode>): Ditto.
	(reduc_sbool_xor_scal_<mode>): Ditto.
	* config/riscv/riscv-protos.h (expand_mask_reduction): Declare.
	* config/riscv/riscv-v.cc (expand_mask_reduction): New function.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/autovec/reduc/reduc-bool-1-run.c: New test.
	* gcc.target/riscv/rvv/autovec/reduc/reduc-bool-1.c: New test.
	* gcc.target/riscv/rvv/autovec/reduc/reduc-bool-2-run.c: New test.
	* gcc.target/riscv/rvv/autovec/reduc/reduc-bool-2.c: New test.
	* gcc.target/riscv/rvv/autovec/reduc/reduc-bool-3-run.c: New test.
	* gcc.target/riscv/rvv/autovec/reduc/reduc-bool-3.c: New test.
	* gcc.target/riscv/rvv/autovec/reduc/reduc-bool-4-run.c: New test.
	* gcc.target/riscv/rvv/autovec/reduc/reduc-bool-4.c: New test.
	* gcc.target/riscv/rvv/autovec/reduc/reduc-bool-5-run.c: New test.
	* gcc.target/riscv/rvv/autovec/reduc/reduc-bool-5.c: New test.
	* gcc.target/riscv/rvv/autovec/reduc/reduc-bool-6-run.c: New test.
	* gcc.target/riscv/rvv/autovec/reduc/reduc-bool-6.c: New test.
	* gcc.target/riscv/rvv/autovec/reduc/reduc-bool-7-run.c: New test.
	* gcc.target/riscv/rvv/autovec/reduc/reduc-bool-7.c: New test.
	* gcc.target/riscv/rvv/autovec/reduc/reduc-bool-8-run.c: New test.
	* gcc.target/riscv/rvv/autovec/reduc/reduc-bool-8.c: New test.
2025-12-09 09:36:03 +01:00
Richard Biener
e3a6035752 target/123027 - handle min/max expansion when -ffinite-math-only
When we get a <= b ? b : a into ix86_expand_sse_fp_minmax we can
swap and invert this with -ffinite-math-only to get a < b ? a : b.

	PR target/123027
	* config/i386/i386-expand.cc (ix86_expand_sse_fp_minmax):
	With !HONOR_NANS we can handle LE by swapping and inverting.

	* gcc.target/i386/pr123027.c: New testcase.
	* gcc.dg/torture/pr123027.c: Likewise.
2025-12-09 08:53:16 +01:00
Nathaniel Shead
cf22e30f0c c++: Non-inline temploid friends should still be COMDAT [PR122819]
Modules allow temploid friends to no longer be implicitly inline, as
functions defined in a class body will not be implicitly inline if
attached to a named module.

This requires us to clean up linkage handling a little bit, mostly by
replacing usages of 'DECL_TEMPLATE_INSTANTIATION' with
'DECL_TEMPLOID_INSTANTIATION' when determining if an entity has vague
linkage.

	PR c++/122819

gcc/cp/ChangeLog:

	* decl.cc (start_preparsed_function): Use
	DECL_TEMPLOID_INSTANTIATION instead of
	DECL_TEMPLATE_INSTANTIATION to check vague linkage.
	* decl2.cc (vague_linkage_p): Likewise.
	(c_parse_final_cleanups): Simplify condition.
	* semantics.cc (expand_or_defer_fn_1): Also check for temploid
	friend functions.

gcc/testsuite/ChangeLog:

	* g++.dg/modules/tpl-friend-22.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
2025-12-09 13:38:23 +11:00
GCC Administrator
8be2b77977 Daily bump. 2025-12-09 00:16:30 +00:00
Andrew Pinski
fae0c62625 final_cleanup: Call make_forwarders_with_degenerate_phis [PR46555]
This fixes a regression introduced with r16-5258-g1d8e2d51e5c5cb.
With GCC 12+, we would not merge forwarders (with phis, vops included),
this meant that after the last cddce, degenerate phis would stay not
merged which allowed for better expansion. Now after my patch, the forwarder
block would be removed and get worse expansion. This fixes the problem
by creating the forwarder blocks in "optimized" and no other cleanupcfg
is called afterwards.

Oh this also fixes the problem at -O1 which was missed because the agressive
version of dce was not done at -O1.

Bootstrapped and tested on x86_64-linux-gnu.

	PR tree-optimization/46555
gcc/ChangeLog:

	* tree-cfgcleanup.cc (execute_cleanup_cfg_post_optimizing):
	Don't set todo to include cleanupcfg; do it manually.
	Call make_forwarders_with_degenerate_phis if optimizing.

gcc/testsuite/ChangeLog:

	* gcc.dg/tree-ssa/pr46555.c: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2025-12-08 14:22:25 -08:00
Andrew Pinski
8e9d923a93 cfg: add debug dump to make_forwarders_with_degenerate_phis.
To understand what this function does, add a debug dump.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

	* tree-cfg.cc (make_forwarders_with_degenerate_phis): Add debug
	dump.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2025-12-08 14:22:24 -08:00
Andrew Pinski
98667f7df0 cfg: Move make_forwarders_with_degenerate_phis to tree-cfg
This moves make_forwarders_with_degenerate_phis to tree-cfg.cc
from tree-ssa-dce.cc to be able to use in a different pass.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

	* tree-ssa-dce.cc (sort_phi_args): Move to tree-cfg.cc.
	(make_forwarders_with_degenerate_phis): Move to tree-cfg.cc.
	(perform_tree_ssa_dce): Update for the updated return type
	of make_forwarders_with_degenerate_phis.
	* tree-cfg.cc (sort_phi_args): Moved from tree-ssa-dce.cc.
	(make_forwarders_with_degenerate_phis): Moved from tree-ssa-dce.cc.
	Update return type to bool and return true if an edge was split.
	* tree-cfg.h (make_forwarders_with_degenerate_phis): New decl.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2025-12-08 14:22:24 -08:00
Eric Botcazou
9d5395a98f Ada: Add missing #include for MinGW
This adds a missing #include for <stdlib.h> and removes redundant ones.

gcc/ada/
	PR ada/123037
	* rtinit.c [__MINGW32__]: Include <stdlib.h> and not <windows.h>.
	* rtfinal.c [__MINGW32__]: Do not include <windows.h>.
2025-12-08 22:37:21 +01:00
Harald Anlauf
cf270d0600 Fortran: [PR123025] Catch Old-style character declarations.
Before this patch we missed the two cases here:

	character*5 string5         ! Gives obsolescent message
	character*(5) string5const  ! Silent with constant
	character*(2+3) string5expr ! Silent with expression

	PR fortran/123025

gcc/fortran/ChangeLog:

	* decl.cc (match_char_length): Add a check for the
	obsolete '*' style of character declarations in the
	alternate branch of checking so we dont miss two
	use cases:

gcc/testsuite/ChangeLog:

	* gfortran.dg/assumed_charlen_dummy.f90: These tests failed
	with the change because of the default -pedantic option
	used by the dg.exp mechanisms. Overide this default.
	* gfortran.dg/automatic_char_len_1.f90: Ditto.
	* gfortran.dg/entry_23.f: Ditto.
	* gfortran.dg/finalize_59.f90: Dito.
	* gfortran.dg/g77/f90-intrinsic-bit.f: Ditto.
	* gfortran.dg/g77/f90-intrinsic-mathematical.f: Ditto.
	* gfortran.dg/g77/f90-intrinsic-numeric.f: Ditto.
	* gfortran.dg/g77/intrinsic-unix-bessel.f: Ditto.
	* gfortran.dg/g77/intrinsic-unix-erf.f: Ditto.
	* gfortran.dg/initialization_9.f90: Ditto.
	* gfortran.dg/intrinsic_actual_4.f90: Ditto.
	* gfortran.dg/namelist_assumed_char.f90: Ditto.
	* gfortran.dg/pr15140.f90: Ditto.

Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org>
2025-12-08 12:48:06 -08:00
Egas Ribeiro
24efdb0974 c++: Document why TARGET_EXPR is not handled in tsubst_expr
TARGET_EXPR represents semantic temporary objects and is deliberately
not handled by tsubst routines, which expect syntactic templated trees.
Add a comment and gcc_unreachable to make this explicit.

gcc/cp/ChangeLog:

	* pt.cc (tsubst_expr): Add TARGET_EXPR case with explanatory
	comment and gcc_unreachable.

Signed-off-by: Egas Ribeiro <egas.g.ribeiro@tecnico.ulisboa.pt>
Reviewed-by: Patrick Palka <ppalka@redhat.com>
2025-12-08 14:28:21 -05:00
Jonathan Wakely
03562c1e02 libstdc++: Implement P2404R3 relaxations to comparable_with concepts [PR122946]
This implements the C++23 proposal P2404R3 "Move-only types for
equality_comparable_with, totally_ordered_with, and
three_way_comparable_with". As agreed with the maintainers of libc++ and
MSVC STL, we treat this as a DR for C++20. It allows reasonable code to
compile which wasn't originally allowed in C++20, and only affects some
obscure subsumption cases for valid C++20 code.

libstdc++-v3/ChangeLog:

	PR libstdc++/122946
	* include/bits/version.def (concepts): Set value to 202207.
	* include/bits/version.h: Regenerate.
	* include/std/concepts (__comparison_common_type_with_impl)
	(__comparison_common_type_with): New helper concepts.
	(equality_comparable_with): Use __comparison_common_type_with.
	* libsupc++/compare (three_way_comparable_with): Likewise.
	(__glibcxx_want_concepts): Define to get __cpp_lib_concepts
	here.
	* testsuite/std/concepts/concepts.compare/move_only.cc: New
	test.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-12-08 18:55:02 +00:00
Jonathan Wakely
ea42e28cbc libstdc++: Extend __is_standard_integer to cover extended integer types
We have __is_signed_integer and __is_unsigned_integer traits which
should have been updated by r16-2190-g4faa42ac0dee2c when making
__int128 an extended integer type (for PR libstdc++/96710). Currently
they check whether the type is a signed integer type or an unsigned
integer type, or a cv-qualified version of one of those. This doesn't
match the standard's definition, which does not include cv-qualified
types. This change ensures that signed __int128 and unsigned __int128
are included in those traits in strict -std modes, and it removes the
use of remove_cv_t so that they are not true for cv-qualified types.
This makes the traits match the meaning of "signed integer type" and
"unsigned integer type" in the standard ([basic.fundamental]).

We also have an __is_standard_integer trait, which is true if either
__is_signed_integer or __is_unsigned_integer is true, but that's also
not a match for the definition in the standard. The definitions of
"signed integer type" and "unsigned integer type" include both standard
and extended integer types, so only saying "standard" in the trait name
is misleading (even before this change, because in non-strict -std modes
the __GLIBCXX_TYPE_INT_N_0 .. __GLIBCXX_TYPE_INT_N_3 types were always
included in the trait, and they aren't standard integer types).

This change renames __is_standard_integer to the more accurate
__is_signed_or_unsigned_integer. Because the set of signed and
unsigned integer types is the same as the set of standard and extended
integer types, the trait could instead have been renamed to
__is_standard_or_extended_integer. I think it's clearer and more
self-explanatory to avoid "standard and extended" and name it for the
signed and unsigned integer types.

N.B. we don't want to call it just __is_integer_type because the integer
types includes cv-qualified types and also bool and the character types
char, wchar_t, char16_t etc.

The consequences of redefining and renaming these traits are small, and
only positive.

Apart from the uses in the __is_standard_integer trait, the only other
uses of __is_signed_integer and __is_unsigned_integer are in <format>
and those uses are unaffected by this change to add 128-bit integers to
the traits. In both uses the type argument is already cv-unqualified,
and there is already explicit handling for 128-bit integers where that
is required.

The existing uses of __is_standard_integer can simply be changed to use
the new name. This does change the behaviour of those uses of the trait,
because the __is_signed_or_unsigned_integer trait now includes
128-bit integers in strict modes. However, that is a desirable change
that fixes some bugs. Specifically, the [utility.intcmp] functions such
as std::cmp_less and the [numeric.sat.arith] functions such as
std::add_sat did not support 128-bit integers in strict modes. Since the
standard says they should be enabled for all signed and unsigned integer
types (or equivalently, for all standard and extended integer types),
those functions should all support __int128 and unsigned __int128. That
is fixed by this change.  Additionally, the same changes in <charconv>,
<mdspan>, and <stdckdint.h> enable the use of 128-bit integers for those
APIs in strict modes.

Finally, this also make a drive-by fix to the enable_if constraints for
the integer overloads of std::from_chars. That used remove_cv_t and so
enabled the overload for lvalue arguments of type const char, which
won't work and should not be enabled.

libstdc++-v3/ChangeLog:

	* include/bits/intcmp.h: Replace all uses of
	__is_standard_integer with __is_signed_or_unsigned_integer.
	* include/bits/max_size_type.h: Fix outdated comment.
	* include/bits/sat_arith.h: Replace all uses of
	__is_standard_integer with __is_signed_or_unsigned_integer.
	* include/c_compatibility/stdckdint.h: Replace all uses of the
	__cv_unqual_signed_or_unsigned_integer_type concept with
	__is_signed_or_unsigned_integer.
	(__cv_unqual_signed_or_unsigned_integer_type): Remove.
	* include/ext/numeric_traits.h: Fix outdated comment.
	* include/std/charconv (from_chars): Replace use of
	__is_standard_integer with __is_signed_or_unsigned_integer.
	Do not enable for cv-qualified char.
	* include/std/mdspan: Likewise.
	* include/std/type_traits (__is_unsigned_integer): Include
	unsigned __int128 in type list.
	(__is_signed_integer): Include signed __int128 in type list.
	(__is_standard_integer): Rename to ...
	(__is_signed_or_unsigned_integer): ... this.
	* testsuite/23_containers/mdspan/extents/ctor_ints.cc: Test
	with 128-bit integers.
	* testsuite/23_containers/mdspan/submdspan/strided_slice.cc:
	Likewise.
	* testsuite/20_util/integer_comparisons/extended.cc: New test.
	* testsuite/26_numerics/saturation/extended.cc: New test.
	* testsuite/26_numerics/stdckdint/extended.cc: New test.

Reviewed-by: Patrick Palka <ppalka@redhat.com>
2025-12-08 18:55:02 +00:00
Egas Ribeiro
bae0ed69e1 c++: Fix SFINAE for deleted explicit specializations [PR119343]
When checking a deleted explicit specialization in a SFINAE context,
we were incorrectly selecting a partial specialization because
resolve_nondeduced_context was calling mark_used.  But resolving an
overload to a single function (per DR 115) does not constitute ODR-use,
so mark_used shouldn't be called there.  Instead callers should call
mark_used or mark_single_function on the result to uniformly handle all
resolvable overloads (even non-template-id ones).

This turns out to fix the below testcase because it causes convert_to_void
for void(X::template g<0>) to properly propagate ODR-use failure (due to
deleted g<0>) and return error_mark_node instead of returning void_node.

	PR c++/119343

gcc/cp/ChangeLog:

	* pt.cc (resolve_nondeduced_context): Remove mark_used call.

gcc/testsuite/ChangeLog:

	* g++.dg/template/sfinae-deleted-pr119343.C: New test.

Signed-off-by: Egas Ribeiro <egas.g.ribeiro@tecnico.ulisboa.pt>
Reviewed-by: Patrick Palka <ppalka@redhat.com>
2025-12-08 12:11:44 -05:00
Joseph Myers
a7b8c5faa6 contrib: Set more site.exp variables in test_installed
Add support in contrib/test_installed for more variables (via
associated command-line options to the script) that gcc/Makefile.in
can set:

* ALT_CC_UNDER_TEST, ALT_CXX_UNDER_TEST and COMPAT_OPTIONS are used in
  compat testing (against the same or a different compiler).

* The libiconv variable is used for testing iconv support for
  particular character sets, and defaults to -liconv if not set in
  site.exp, which is wrong on systems with iconv in libc; keep the
  default, but add an option to override this.

  Note that the dg-require-iconv testing is currently bogus in a cross
  environment, and this patch does nothing to address that.  The tests
  using dg-require-iconv actually care about character set support on
  the *host*, for character conversions carried out in the compiler,
  and the libiconv setting put in site.exp by gcc/Makefile.in is a
  *host* library setting.  But dg-require-iconv /
  check_iconv_available tests availability when compiling, linking and
  executing for the *target*.  If the host and target have close
  enough to the same OS, this may work by accident, but otherwise it
  will incorrectly enable / disable these tests based on target
  information (but using a libiconv setting designed for the host)
  when it should be based on host information.

	* test_installed (--with-alt-cc=, --with-alt-cxx=)
	(--with-compat-options=, --with-libiconv=): New options.
2025-12-08 17:02:22 +00:00
Eric Botcazou
3777a0b41f MinGW: Fix native TLS bug with -fdata-sections
The problem comes from a quirk of the GNU PE-COFF linker, which wants
to make sure that .tls$ZZZ is laid out last among the TLS sections,
but first globs all .tls$* sections together.  The solution matches
Clang's output.

gcc/
	PR target/80881
	* config/mingw/winnt.cc (mingw_pe_unique_section): Put two dollar
	signs for TLS sections after the prefix.
	(mingw_pe_asm_named_section): Deal with all TLS sections uniformly.

gcc/testsuite/
	* gcc.dg/tls/data-sections-1.c: New test.
2025-12-08 17:50:45 +01:00
Nathan Myers
76fc22a292 Add ncm to MAINTAINERS
gcc/Changelog:

	* MAINTAINERS: add ncm
2025-12-08 10:36:41 -05:00
Ezra Sitorus
fdf36f5fa3 aarch64: Add support for C1 cores
Add support for C1-Nano, C1-Pro, C1-Premium and C1-Ultra.

gcc/ChangeLog:

	* config/aarch64/aarch64-cores.def (AARCH64_CORE): Add C1-Nano,
	C1-Pro, C1-Premium and C1-Ultra.
	* config/aarch64/aarch64-tune.md: Regenerate.
	* doc/invoke.texi: Document C1 cores.
2025-12-08 14:46:13 +00:00