Commit Graph

227148 Commits

Author SHA1 Message Date
GCC Administrator
64c9fcfa70 Daily bump. 2026-02-16 00:16:25 +00:00
Rainer Orth
0a48b1fe98 Change int8_t to signed char on Solaris [PR113450,PR123176]
int8_t is currently defined as char in Solaris <sys/int_types.h>

/*
 * Basic / Extended integer types
 *
 * The following defines the basic fixed-size integer types.
 *
 * Implementations are free to typedef them to Standard C integer types or
 * extensions that they support. If an implementation does not support one
 * of the particular integer data types below, then it should not define the
 * typedefs and macros corresponding to that data type.  Note that int8_t
 * is not defined in -Xs mode on ISAs for which the ABI specifies "char"
 * as an unsigned entity because there is no way to define an eight bit
 * signed integral.
 */
typedef char			int8_t;
typedef signed char		int8_t;

and _CHAR_IS_SIGNED defined as 1 in <sys/isa_defs.h>.  As has long been
known, this violates C99, 7.18.1.1, Exact-width integer types.

While this works in general nonetheless, it creates constant trouble for
C++ code as can be seen in PRs libstdc++/113450 and recently
libstdc++/123176, but also in LLVM.

While Oracle Solaris engineering is amenable to changing int8_t to
signed char, this will take time.  However, it proved easy to do so now
using fixincludes.

This works for a GCC bootstrap just fine with one exception: as
documented in PR d/123509, libdruntime has its own definition of int8_t
which is now inconsistent with GCC's.  This leads to some gdc.test and
libphobos testsuite failures, which can easily be fixed with the patch
attached to that PR.  I wouldn't consider this a showstopper for GCC 16
if that patch wouldn't make it to the release.

However, the failures point to another problem: with this change, the
mangling of

	void func(int8_t);

changes in C++, creating an ABI break.  Fortunately, this isn't seen in
libstdc++, so the impact should be reasonable compared to the constant
trouble the current definition causes for C++.

Besides, clang already uses

	#define __INT8_TYPE__ signed char

apparently without problems.

In case users do run into the incompatiblity, the fixed definitions are
wrapped in #if !defined(_LEGACY_INT8_T)/#endif so there's an easy way back
to the original definition.

Bootstrapped on i386-pc-solaris2.11, amd64-pc-solaris2.11,
sparc-sun-solaris2.11, and sparcv9-sun-solaris2.11 with only the D
failure described above.

I've also run 1-stage and bootstrap builds of LLVM main using a patched
GCC 16 as bootstrap compiler on amd64-pc-solaris2.11 and
sparcv9-sun-solaris2.11 without regressions.

2026-01-07  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	fixincludes:
	PR libstdc++/113450
	PR libstdc++/123176
	* inclhack.def (solaris_int8_t): New fix.
	* fixincl.x: Regenerate.

	gcc:
	PR libstdc++/113450
	PR libstdc++/123176
	* config/sol2.h (INT8_TYPE): Change to signed char.
	(INT_LEAST8_TYPE): Likewise.
	(INT_FAST8_TYPE): Likewise.
2026-02-15 23:11:44 +01:00
Iain Sandoe
dfc93622ad diagnostics: Fix bootstrap on 32b Darwin hosts.
The change in r16-7507 misses a cast on the value to pp_scalar which
leads to a bootstrap fail on 32b hosts where size_t has a different
declaration from the value.  Fixed by applying the fmt_size_t cast.

gcc/ChangeLog:

	* json.cc (pointer::token::print): Cast the value to pp_scalar
	with (fmt_size_t).

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2026-02-15 20:12:01 +00:00
Jan Hubicka
8cf191e937 Disable simpe-call devirtualization of already devirtualized calls
Fix ICE caused by speculating already speculated target with auto-fdo.
ipa_devirt is supposed to consistently skip devirtualized edges (or just check
if devirtualization agrees with the static prediction when dumping).  This was
not hecked correctly in the simpe call path.

gcc/ChangeLog:

	* ipa-devirt.cc (ipa_devirt): Improve statistics for multi-target
	devirtualization; do not simple-call devirtualize already devirtualized calls.
2026-02-15 20:19:57 +01:00
Patrick Palka
24f012160c c++: non-trivial by-value deducing this lambda [PR121500]
Here the lambda has a by-value capture of non-trivial type, which
in turn makes the closure type non-trivial.  This means its by-value
'this' parameter, which gets deduced to the closure type, becomes an
invisiref parameter, and so when lowering the operator() body we need to
adjust uses of 'this' by adding implicit dereferences.

But the GIMPLE dump for operator() shows that we miss some adjustments:

  bool main()::<lambda(this auto:1)>::operator()<main()::<lambda(this auto:1)> > (struct ._anon_0 & self)
  {
    bool D.3091;
    struct ._anon_0 & self.1;
    struct A a [value-expr: self.__a]; // should be self->__a

    self.1 = self;
    _1 = self.1.__a.n; // should be self.1->__a
    D.3091 = _1 == 42;
    return D.3091;
  }

Apparently this is because cp_genericize_r, which is responsible for the
invisiref use adjustments, never walks DECL_VALUE_EXPR.  This patch makes
us walk it.  For GCC 16, restrict the walking to xobj lambdas.

	PR c++/121500

gcc/cp/ChangeLog:

	* cp-gimplify.cc (cp_genericize_r): Walk DECL_VALUE_EXPR within
	an xobj lambda.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp23/explicit-obj-lambda20.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
2026-02-15 12:36:38 -05:00
Rainer Orth
a0b0067921 Remove HAVE_AS_FMAF_HPC_VIS3 etc. on SPARC
The SPARC ISA extensions guarded by HAVE_AS_FMAF_HPC_VIS3 etc. have been
supported both in the Solaris as and GNU as for a long time.  The
original Solaris 11.4 as supports all of them, and gas support has been
added over time:

  HAVE_AS_FMAF_HPC_VIS3		-xarch=v9d		2.22
  HAVE_AS_SPARC4                -xarch=sparc4		2.23.1
  HAVE_AS_SPARC5_VIS4           -xarch=sparc5           2.25
  HAVE_AS_SPARC6                -xarch=sparc6           2.29

Solaris requires binutils 2.30 already on trunk, and 2.29 can be
expected on other SPARC targets, too, so this patch removes all code
that checks for their presence.

Bootstrapped without regressions on sparc-sun-solaris2.11 (as and gas),
sparcv9-sun-solaris2.11 (as), and sparc64-unknown-linux-gnu.

2026-02-14  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	gcc:
	* configure.ac <sparc*-*-*> (gcc_cv_as_sparc_fmaf): Remove.
	(gcc_cv_as_sparc_sparc4): Remove.
	(gcc_cv_as_sparc_sparc): Remove.
	(gcc_cv_as_sparc_sparc6): Remove.
	* configure: Regenerate.
	* config.in: Regenerate.

	* config/sparc/sparc.h (AS_NIAGARA3_FLAG) Remove.  Replace uses by
	definition.
	(AS_NIAGARA4_FLAG): Likewise.
	(AS_NIAGARA7_FLAG): Likewise.
	(AS_M8_FLAG): Likewise.
	* config/sparc/sol2.h [!HAVE_AS_SPARC4]: Remove.
	(AS_SPARC32_FLAG): Remove.
	(AS_SPARC64_FLAG): Remove.
	(AS_NIAGARA3_FLAG) Replace uses by definition.
	(AS_NIAGARA4_FLAG): Likewise.
	(AS_NIAGARA7_FLAG): Likewise.
	(AS_M8_FLAG): Likewise.
	* config/sparc/sparc.cc (sparc_option_override):
	[!HAVE_AS_FMAF_HPC_VIS3]: Remove.
	[!HAVE_AS_SPARC4]: Likewise.
	[!HAVE_AS_SPARC5_VIS4]: Likewise.
	[!HAVE_AS_SPARC6]: Likewise.
2026-02-15 11:33:41 +01:00
Andrew Pinski
7e8e4dac65 forwprop: Fix copy prop aggregates into return statements slightly [PR124099]
So a few more restrictions are needed here.
First we don't need to change if the return statement is already
a RESULT_DECL nor deference of the RESULT_DECL.
Second proping a global variable into the return is ok for the most
part except enumtls does not know how to expand that correctly and things
go down hill. So restrict to non global vars now.

Bootstrapped and tested on x86_64-linux-gnu.
Also tested the testcase with TLS turned off so enumtls ran.

	PR tree-optimization/124099

gcc/ChangeLog:

	* tree-ssa-forwprop.cc (optimize_agr_copyprop_return): Don't do anything
	if the return is already result decl or a deference of result decl.
	Also reject non local var decls.

gcc/testsuite/ChangeLog:

	* gcc.dg/torture/tls-return-1.c: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2026-02-15 00:25:17 -08:00
Paul Thomas
26f81567c1 Fortran: Prevent direct references to PDT instances [PR108663]
2026-02-15  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
	PR fortran/108663
	* decl.cc (gfc_get_pdt_instance): Use PDT_PREFIX and
	PDT_PREFIX_LEN.
	* gfortran.h : Define PDT_PREFIX and PDT_PREFIX_LEN. Note that
	PDT_PREFIX must have at least two upper case letters.
	* module.cc (read_module): Use PDT_PREFIX and PDT_PREFIX_LEN.
	* resolve.cc (resolve_typebound_procedure): Both pdt_template
	and pdt_type resolve_bindings_derived dummies should be tested
	for LEN type parameters being assumed.
	* symbol.cc (gfc_pdt_is_instance_of): Update preceding comment
	and use PDT_PREFIX_LEN.

gcc/testsuite
	PR fortran/108663
	* gfortran.dg/pdt_15.f03: Modify tree dump test for new prefix.
	* gfortran.dg/pdt_71.f03: Ditto.
	* gfortran.dg/pdt_79.f03: Ditto.
	* gfortran.dg/pdt_84.f03: New test.
2026-02-15 08:11:31 +00:00
Andrew Pinski
61d356b4f0 testsuite: Fix pr124086-1.c for ia32 (and maybe others)
On some targets (ia32 for an example), sizeof long double
is not a power of 2, this means you can't create a vector
of it. So let's disable this testcase for non power of 2
sizeof long double. This needs to be done via a preprocessor
macro as vector_size would cause an error otherwise.

Committed as obvious after a test on x86_64 with -m32.

gcc/testsuite/ChangeLog:

	* c-c++-common/torture/pr124086-1.c: Only enable
	for power of 2 long double.
2026-02-14 22:38:56 -08:00
GCC Administrator
83720e914d Daily bump. 2026-02-15 00:16:25 +00:00
Jakub Jelinek
3a1bb1b70d libgcobol: Add --with-target-libxml2{,-lib,-include}= configure options [PR122839]
The following patch adds new configure options similar to ObjC/Algol68
--with-bdw-gc{,-lib,-include}= configure options where one can override
the default of -I /usr/include/libxml2 and -lxml2 for finding libxml2
headers and library.  Similarly to the bdw-gc options, the override can
be for all multilibs or just specific to each multilib.

Tested also with
../configure --enable-languages=c,c++,cobol --with-target-libxml2=/tmp/libxml2 \
--disable-bootstrap --disable-libsanitizer --disable-libgomp

2026-02-14  Jakub Jelinek  <jakub@redhat.com>

	PR cobol/122839
	* configure.ac (--with-target-libxml2, --with-target-libxml2-include,
	--with-target-libxml2-lib): New configure options, use those to find
	libxml2.
	(LIBXML2_CPPFLAGS, LIBXML2_LIBS): New AC_SUBSTs.
	* Makefile.am (AM_CPPFLAGS): Add $(LIBXML2_CPPFLAGS) rather than
	-I /usr/include/libxml2.
	(libgcobol_la_LDFLAGS): Add $(LIBXML2_LIBS).
	* configure: Regenerate.
	* config.h.in: Regenerate.
	* Makefile.in: Regenerate.

	* doc/install.texi (COBOL-Specific Options): New.
2026-02-14 18:05:38 +01:00
Rainer Orth
d37f4b2a1a Remove HAVE_AS_SPARC_GOTDATA_OP
Since the introduction of gcc_cv_as_flags on SPARC,
HAVE_AS_SPARC_GOTDATA_OP became undefined on sparcv9-sun-solaris2.11
with the native assembler.  This happens because /bin/as is now invoked
with -m64, but the test fails to assemble:

/bin/as: "gotdata_op.s", line 8: error: detect global register use not covered .register pseudo-op

While the test can be adjusted by the addition of

	.register %g2, #scratch

which makes it work with both as -m32/-m64 and gas --32/--64, it
turns out the whole workaround has become unnecessary:

When trying all combinations of as/ld with -m32/-m64, with both the
original Solaris 11.4 as/ld and the current one, as well as gas/gld
2.20.1, 2.30, and 2.46, the only cases where the test fails are when
using gld 2.20.1.  Solaris/SPARC requires binutils 2.30 now, and 2.20.1
can be considered ancient history on Linux/sparc64, too.  Therefore the
test and the code guarded by it can just go.

Bootstrapped without regressions on sparc{,v9}-sun-solaris2.11 and
sparc64-unknown-linux-gnu.

2026-02-12  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	gcc:
	* configure.ac <sparc*-*-*> (gcc_cv_as_sparc_gotdata_op): Remove.
	* configure: Regenerate.
	* config.in: Regenerate.
	* config/sparc/sparc.md [!HAVE_AS_SPARC_GOTDATA_OP]: Remove.
2026-02-14 16:21:23 +01:00
Kalvis Duckmanton
8a9490979b VAX: Fix ICE in fixup_reorder_chain when building gimple_match.cc [PR112400]
When cross-compiling itself for VAX, GCC terminates abruptly with an ICE
when compiling gimple_match.cc; the root cause seems to be an
incompletely removed computed jump instruction, which causes the
assertion in cfgrtl.cc around line 4083, to no longer hold.

I have verified that the problem is present in GCC 15.2.0 and believe
that it's also present in trunk (based on the fact that the patterns for
the "casesi1" and "*casesi1" instructions in 15.2.0 and trunk are the
same).

To fix this issue wrap the limit operand in a USE, to allow `single_set'
to identify it as an RTL expression setting PC.  This allows the
optimizer to optimize away case statements branching only to a basic
block, removing the ICE.

Include a test case reduced from gimple_match.cc, which demonstrates the
problem in GCC 15.2.0 on NetBSD/amd64 cross-compiling for VAX.

	gcc/
	PR target/112400
	* config/vax/vax.md (casesi1): Wrap naked operand 1 with a USE
	where used with the insn split to.
	(*casesi1): Likewise naked incoming operand 1.

	gcc/testsuite/
	PR target/112400
	* g++.dg/torture/pr112400.C: New file.
2026-02-14 15:10:15 +00:00
Maciej W. Rozycki
feda1cfe15 VAX: Fix invalid RTX operand access in `nonindexed_address_p'
Replace an unguarded early access to the incoming RTX's operand 0 in
`nonindexed_address_p' with direct accesses at the actual use places,
fixing a libgcc build error:

during RTL pass: reload
.../libgcc/libgcc2.c: In function '__udiv_w_sdiv':
.../libgcc/libgcc2.c:649:1: internal compiler error: RTL check: expected elt 0 type 'e' or 'u', have 'r' (rtx reg) in nonindexed_address_p, at config/vax/vax.cc:1826

where `--enable-checking=rtl' has been specified so as to enable RTL
consistency checks.

	gcc/
	* config/vax/vax.cc (nonindexed_address_p): Move incoming RTX's
	operand 0 access to the actual use places.
2026-02-14 14:24:46 +00:00
Christopher Albert
edced0fe1e fortran: Fix DO CONCURRENT nested-in-block iterator counting [PR123943]
Fix iterator-depth pre-counting in gfc_resolve_forall for nested
DO CONCURRENT/FORALL constructs inside block arms (e.g. IF/ELSE,
SELECT CASE).  The previous logic only scanned a flat next-chain,
which could undercount and trigger an ICE assertion.

Add a regression test based on a reduced testcase from Harald Anlauf.
Adjust wording in one comment to avoid GNU-style checker complaints.

	PR fortran/123943

gcc/fortran/ChangeLog:

	* resolve.cc (gfc_max_forall_iterators_in_chain): New helper
	function for factorization of iterator-depth counting.
	(gfc_count_forall_iterators): Use it.

gcc/testsuite/ChangeLog:

	* gfortran.dg/pr123943.f90: New test.

Co-authored-by: Harald Anlauf <anlauf@gcc.gnu.org>
Signed-off-by: Christopher Albert <albert@tugraz.at>
2026-02-14 15:09:48 +01:00
Paul Thomas
904b7a3010 Fortran: Implement the COSHAPE intrinsic [PR99250]
2026-02-14  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
	PR fortran/99250
	* check.cc (gfc_check_coshape): New function.
	* gfortran.h: Add GFC_ISYM_COSHAPE to gfc_isym_id.
	* intrinsic.cc (add_functions): Add the coshape prototype and
	its 'make_generic'.
	* intrinsic.h: Add prototypes for gfc_check_coshape and
	gfc_resolve_coshape.
	* intrinsic.texi : Add entries for coshape.
	* iresolve.cc (gfc_resolve_coshape): New function.
	* trans-array.cc (gfc_conv_ss_startstride): Add 'case
	GFC_ISYM_COSHAPE' in two places.
	* trans-intrinsic.cc (conv_intrinsic_cobound): Modify assert in
	scalarized section for lbound. Set bound to zero for scalar
	case of coshape. Keep the lbound and use it together with the
	scalarized ubound to obtain the coshape.
	(gfc_conv_intrinsic_function, gfc_add_intrinsic_ss_code and
	gfc_walk_intrinsic_function): Add 'case GFC_ISYM_COSHAPE' as
	appropriate.

gcc/testsuite/
	PR fortran/99250
	* gfortran.dg/coshape_1.f90: New test.
2026-02-14 08:48:11 +00:00
Andrew Pinski
f7677c695f complex-lowering: Fix up extraction with VCEs [PR124086]
This was an oversight on my part when I converted extract_component
to use gimple_build_assign instead of force_gimple_operand_gsi.
I had provided a special case for VCE of a SSA_NAME but I missed
that the same issue would be caused with invariants too and invariants
would show up with VCE; I assumed they would be folded.
This changes the check to include invariants too.

Bootstrapped and tested on x86_64-linux-gnu.

	PR tree-optimization/124086

gcc/ChangeLog:

	* tree-complex.cc (extract_component): Extend the check
	for ssa names for VCE to include invariants.

gcc/testsuite/ChangeLog:

	* c-c++-common/torture/pr124086-1.c: New test.
	* g++.dg/torture/pr124086-1.C: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2026-02-13 23:52:33 -08:00
Andrew Pinski
cab12fb6cd testsuite: Limit dump check of copy-prop-aggregate-return-1.c to x86_64 and aarch64
This testcase fails on some targets so just limit to x86_64 (non-ia32) and aarch64
which are known to work here.

Pushed as obvious after testing.

gcc/testsuite/ChangeLog:

	* gcc.dg/tree-ssa/copy-prop-aggregate-return-1.c: Limit check to x86_64
	and aarch64.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2026-02-13 20:14:09 -08:00
Andrew Pinski
3758cd182e testsuite: Disable uninit-pr95825-1.C if address sanitizer is not supported
I had forgot to check to make sure address sanitizer is supported.
Disable this test case if there is no address sanitizer.

Pushed as obvious after testing it.

gcc/testsuite/ChangeLog:

	* g++.dg/warn/uninit-pr95825-1.C: Skip if no address sanitizer.
2026-02-13 20:14:09 -08:00
GCC Administrator
41ef3284c9 Daily bump. 2026-02-14 00:16:28 +00:00
David Malcolm
7c73f9a347 sarif-replay: fix escaping of JSON Pointer
gcc/ChangeLog:
	* json-parsing.cc (selftest::assert_json_pointer_eq): New.
	(ASSERT_JSON_POINTER_EQ): New.
	(selftest::test_parse_object): Add tests of JSON pointer.
	(selftest::test_pointer_escaping): New test.
	(selftest::json_parser_cc_tests): Call it.
	* json.cc (json::pointer::token::print): New.
	(json::value::print_pointer): New.
	* json.h (json::pointer::token::print): New decl.
	(json::value::print_pointer): New decl.
	* libsarifreplay.cc: Include pretty-print.h.
	(make_logical_location_from_jv): Use
	json::pointer::token::print for short_name.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2026-02-13 17:18:49 -05:00
Vladimir N. Makarov
498983d961 [PR124079, LRA]: Fix broken s390 SPEC2017 benchmarks
Recent patch for PR121191 broke compilation of s390 SPEC benchmarks.
This patch fixes it.  The patch uses existing lra_constraint_offset to
calculate offsets.  The same function is used to find invalid matching
reloads.

gcc/ChangeLog:

	PR rtl-optimization/124079
	* lra-constraints.cc (get_matching_reload_reg_subreg): Add new arg
	rclass.  Use another condition to use lowpart_subreg.  Use lra_constraint_offset
	to calculate the subreg offset.
	(get_reload_reg, match_reload): Pass the new arg.

gcc/testsuite/ChangeLog:

	PR rtl-optimization/124079
	* gcc.target/s390/pr124079.c: New.
2026-02-13 13:59:26 -05:00
Robert Dubner
8a794643cc cobol: Optimized alpha-to-alpha moves. [PR119455]
Code for implementing many common scenarios of "MOVE <literal> TO
<alphanumeric>" and " MOVE <alphanumeric> to <alphanumeric> " is created
directly through GENERIC rather than by calling the general-purpose
libgcobol __gg__move routine.

gcc/cobol/ChangeLog:

	PR cobol/119455
	* genapi.cc (mh_source_is_group): Formatting.
	(mh_source_is_literalA): Implement accelerated move.
	(mh_alpha_to_alpha): New function; implements accelerated move.
	(move_helper): Calls new mh_alpha_to_alpha.
2026-02-13 13:34:58 -05:00
Andrew Pinski
b960a57e1b forwprop: Add copy prop for aggregates into a return [PR95825]
I didn't implement this before today as I had not see any code
where this would make a difference. I noticed while looking into
regressions an uninitialized warning that shows up only with
-fsanitize=address. This because SRA causes some extra total
scalaization when using -fsanitize=address. Which in turn exposes
an uninitialized warning. This fixes the uninitialized warning
by doing a simple copy prop into the return statement.

That is if we have:
```
  D.3407 = D.3418;
  return D.3407;
```

turn it into:
```
  D.3407 = D.3418;
  return D.3418;
```

This forces SRA not to do total scalarization on D.3418 and allows for better code
too.

Bootstrapped and tested on x86_64-linux-gnu.

	PR tree-optimization/95825

gcc/ChangeLog:

	* tree-ssa-forwprop.cc (optimize_agr_copyprop_return): New function.
	(optimize_agr_copyprop): Call optimize_agr_copyprop_return
	for return statements.

gcc/testsuite/ChangeLog:

	* g++.dg/warn/uninit-pr95825-1.C: New test.
	* gcc.dg/tree-ssa/copy-prop-aggregate-return-1.c: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2026-02-13 09:01:33 -08:00
Marek Polacek
68957163b8 c++/reflection: various diagnostic tweaks
This patch improves various reflection diagnostics as discussed in
<https://gcc.gnu.org/pipermail/gcc-patches/2025-December/704168.html>.

In particular:
- reword "not usable" diagnostics to say what kind of reflections we
  expected,
- use the new inform_tree_category to better describe what kind of reflection
  we actually got,
- when we see a missing 'template' keyword, emit a -Wmissing-template-keyword
  warning instead of giving a hard error (this should only happen when the
  code would be valid with the 'template' added.

gcc/cp/ChangeLog:

	* cp-tree.h (inform_tree_category): Declare.
	* error.cc (inform_tree_category): New.
	* parser.cc (cp_parser_splice_specifier): Use OVL_FIRST when checking
	for TEMPLATE_DECL.
	(cp_parser_splice_type_specifier): Reword an error message.  Call
	inform_tree_category.
	(cp_parser_splice_expression): Check check_splice_expr earlier.  Reword
	error messages.  Call inform_tree_category.  Turn an error into an
	assert.  Use missing_template_diag instead of giving an error about
	a missing 'template' keyword.
	(cp_parser_splice_scope_specifier): Reword an error message.  Call
	inform_tree_category.
	(missing_template_diag): Forward declare.  Drop "enum" in a parameter.
	* reflect.cc (check_splice_expr): Reword error messages.  Call
	inform_tree_category.

gcc/testsuite/ChangeLog:

	* g++.dg/reflect/crash10.C: Adjust expected diagnostics.
	* g++.dg/reflect/crash2.C: Likewise.
	* g++.dg/reflect/crash3.C: Likewise.
	* g++.dg/reflect/crash7.C: Likewise.
	* g++.dg/reflect/crash9.C: Likewise.
	* g++.dg/reflect/dep5.C: Likewise.
	* g++.dg/reflect/diag1.C: Likewise.
	* g++.dg/reflect/error10.C: Likewise.
	* g++.dg/reflect/error12.C: Likewise.
	* g++.dg/reflect/error5.C: Likewise.
	* g++.dg/reflect/expr3.C: Likewise.
	* g++.dg/reflect/member1.C: Likewise.
	* g++.dg/reflect/ns2.C: Likewise.  Test more cases.
	* g++.dg/reflect/p2996-12.C: Likewise.
	* g++.dg/reflect/splice5.C: Likewise.
	* g++.dg/reflect/diag1a.C: New test.
	* g++.dg/reflect/diag1b.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
2026-02-13 11:16:38 -05:00
Jakub Jelinek
c7c02eeae1 c++: Fix up consteval-only diagnostics with structured bindings [PR124012]
We ICE on the following testcase, because a constexpr structured binding
with consteval-only initializer of the whole struct but not for this exact
structured binding is used in a context where it is not constant evaluated
and folded into a constant.

The problem is that check_out_of_consteval_use during walking didn't walk
DECL_VALUE_EXPR of vars it sees being used.  So we haven't noticed invalid
consteval-only use, the consteval-only base of the structured binding isn't
gimplified but the structured binding referencing that in its
DECL_VALUE_EXPR is and so we ICE during gimplification.
In order to fix that, I had to move the lambda into a separate function
(similarly to why consteval_only_type_r is not a lambda) so that it can
recurse with that.

That isn't the only problem though.  DECL_VALUE_EXPR in this case is just
COMPONENT_REF with the underlying VAR_DECL (which is consteval-only).
But walker had:
      if (VAR_P (t)
          && (DECL_DECLARED_CONSTEXPR_P (t) || DECL_DECLARED_CONSTINIT_P (t)))
        /* This is fine, don't bother checking the type.  */
        return NULL_TREE;
and so wouldn't report anything even after the fix.
The reason why it works correctly in the
  constexpr auto a = A {};
  foo (a.a);                   // { dg-error "consteval-only expressions are only allowed in a constant-evaluated context" }
case is that in that case (no DECL_VALUE_EXPR) there is COMPONENT_REF
of VIEW_CONVERT_EXPR of the VAR_DECL (i.e. location wrapper) and so we
diagnose it on the location wrapper.  That is just weird, we really
shouldn't depend on location wrappers being there for correct behavior
(rather than just for better locations).  That if is there because
cp_finish_decl calls check_out_of_consteval_use on the whole VAR_DECL
and in that case we want to avoid diagnosing anything if it is
constexpr/constinit var.  Maybe we just shouldn't call
check_out_of_consteval_use at all, though this patch moves that check to
an early out in that function rather than during the walk (similarly
to early out for expr == NULL_TREE which also happens occassionally).
If we see a constexpr/constinit VAR_DECL which is consteval-only
nested somewhere deep inside of other expressions, we should diagnose
that.

On Wed, Feb 11, 2026 at 08:58:26PM +0900, Jason Merrill wrote:
> I'd drop constinit, that doesn't seem to qualify under
> [basic.types.general]/12.1.

You're right.  Seems constinit was still in P2996R9 but P2996R10
has removed it except for one occurrence in the revision history (that
is ok, but surprisingly the P2996R10 change that removed it is not
mentioned).  So, this patch additionally stops special casing constinit
for consteval-only checks anywhere, only constexpr is significant.

There is an unresolved part of the PR, if there is
  constexpr auto a = A {};
  int b = a.a;
then we don't reject that (similarly after the patch with constexpr
structured binding).  The problem in that case is that we try to
constant evaluate initializers of vars (and a few other spots) and
if they fold to constants (like in this case to 0) even when it is
not manifestly constant-evaluated, we just replace it with the constant
and so don't see there was a consteval-only use that should have
been reported.  Of course, if it is something manifestly constant-evaluated
and folds into constant, it shouldn't be rejected.
So I wonder if we don't need to call check_out_of_consteval_use in
further spots...

2026-02-13  Jakub Jelinek  <jakub@redhat.com>

	PR c++/124012
	* reflect.cc (check_out_of_consteval_use_r): New function.
	(check_out_of_consteval_use): Use it instead of lambda.  Don't ignore
	constexpr/constinit vars in the walker and walk DECL_VALUE_EXPR of
	vars which have it.  Ignore expr equal to constexpr VAR_DECL.  In
	diagnostics only complain about missing constexpr on VAR_DECLs without
	that flag and never suggest constinit.  Remove constinit traces from
	function comment.

	* g++.dg/reflect/pr124012.C: New test.
	* g++.dg/reflect/init1.C (r): Change constinit to constexpr.
	(p): Change constinit to constexpr const.
	* g++.dg/reflect/init6.C: Expect diagnostics for constinit
	consteval-only vars.
	* g++.dg/reflect/init7.C: Likewise.
	* g++.dg/reflect/init10.C: Likewise.
	* g++.dg/reflect/diag3.C: Likewise.  Don't expect suggestion to
	add constinit.
2026-02-13 16:11:07 +01:00
Richard Biener
539e6a4178 testsuite/115827 - avoid false negative because of CCP
The following adjusts two uninit testcases to avoid a false negative
that appears when using -msoft-float on arm because the testcase
then mutates into a classical case of CCP eliding

  # _11 = PHI <1.0e+0(2), f$real_9(D)(3)>

Avoid this by using a non-constant.  And avoid flipping locations
for the diagnostic by not duplicating the return statement.

	PR testsuite/115827
	* gcc.dg/auto-init-uninit-17.c: Avoid CCP.
	* gcc.dg/uninit-17.c: Likewise.
2026-02-13 15:28:16 +01:00
David Malcolm
5885a88153 diagnostics: don't cache logical_loc_mgr in html_sink [PR124014]
r16-7422-g13c2da6cdbd1a3 fixed an ICE that was due to caching of the
logical_locations::manager * in sarif_sink.

Do the same for html_sink.

gcc/ChangeLog:
	PR diagnostics/124014
	* diagnostics/html-sink.cc (html_builder::get_logical_loc_mgr):
	New.
	(html_builder::m_logical_loc_mgr): Drop field.
	(html_builder::html_builder): Drop initialization of
	m_logical_loc_mgr.
	(html_builder::maybe_make_state_diagram): Use get_logical_loc_mgr
	rather than m_logical_loc_mgr.
	(html_builder::make_element_for_diagnostic): Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2026-02-13 08:26:50 -05:00
Richard Biener
20a94796ae tree-optimization/99959 - fixup DECL_NONLOCAL_FRAME use
DECL_NONLOCAL_FRAME is only valid on VAR_DECL.

	PR tree-optimization/99959
	* tree-sra.cc (create_access_replacement): Guard DECL_NONLOCAL_FRAME
	access.
2026-02-13 12:58:55 +01:00
Tobias Burnus
eb311dc3db Fix gcc/testsuite/*/gomp/pr113436* [PR113436]
Testcases in gcc/testsuite/ may not '#include <omp.h>' or 'use omp_lib';
instead, now a local declaration of the enum/Fortran-parameter values is
used.

gcc/testsuite/ChangeLog:

	PR middle-end/113436
	* c-c++-common/gomp/pr113436-1.c: Replace '#include <omp.h>' by
	local declaration for omp_allocator_handle_t.
	* c-c++-common/gomp/pr113436-2.c: Likewise.
	* g++.dg/gomp/pr113436.C: Likewise.
	* gfortran.dg/gomp/pr113436-1.f90: Replace 'use omp_lib' by local
	omp_*_mem_alloc parameter declarations.
	* gfortran.dg/gomp/pr113436-2.f90: Likewise.
	* gfortran.dg/gomp/pr113436-3.f90: Likewise.
	* gfortran.dg/gomp/pr113436-4.f90: Likewise.
2026-02-13 12:29:03 +01:00
Tomasz Kamiński
fa1149534d libstdc++: Make __gnu_test:uneq_allocator(int) constructor explicit.
Presence implicit conversion from int to it's allocator, makes constructing
string from rvalue of same string type and int ambiguous, as none of following
candidates is better:
  basic_string(basic_string&&, allocator_type)
  // conversion from int to allocator for second argument
  basic_string(const basic_string&, int, allocator_type)
  // reference adjustment for first argument

This makes __gnu_test:uneq_allocator(int) constructor explicit, to avoid
above issues.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/scoped_allocator/construct_pair_c++2a.cc
	(__gnu_test::uneq_allocator(int)): Declare as explicit.
	* testsuite/std/memory/indirect/ctor.cc: Construct uneq_allocator
	from int explicitly.
	* testsuite/std/memory/polymorphic/ctor.cc: Likewise.
	* testsuite/std/memory/polymorphic/ctor_poly.cc: Likewise.
	* testsuite/util/testsuite_allocator.h: Likewise.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-02-13 11:09:34 +01:00
Richard Biener
4f9a973a3f tree-optimization/99959 - handle FRAME in SRA for diagnostics
The following includes DECL_NONLOCAL_FRAME in the processing for
setting debug expressions on access replacements, avoiding disabling
diagnostics.

	PR tree-optimization/99959
	* tree-sra.cc (create_access_replacement): Always create
	debug expressions for DECL_NONLOCAL_FRAME bases.

	* gcc.dg/uninit-pr99959.c: New testcase.
2026-02-13 11:08:55 +01:00
Jonathan Wakely
7bafcc3617 libstdc++: Make CTAD ignore tuple(const Types&...) constructor [PR121771]
This is similar to the r16-3536-g0bb0d1d2880d56 change for std::pair, so
that CTAD ignores the tuple(const Types&...) constructor and only uses
the tuple(Types...) -> tuple<Types...> deduction guide. This ensures
that the deduced type comes from the decayed argument types.

libstdc++-v3/ChangeLog:

	PR libstdc++/121771
	* include/std/tuple (tuple::tuple(const Elements&...)): Use
	type_identity_t to prevent constructor being used for CTAD.
	(tuple::tuple(allocator_arg_t, const A&, const Elements&...)):
	Likewise.
	* testsuite/20_util/tuple/cons/121771.cc: New test.

Reviewed-by: Ville Voutilainen <ville.voutilainen@gmail.com>
2026-02-13 09:06:31 +00:00
Dhruv Chawla
705d87ba8e AutoFDO: Update profile_merger gcov_version to 3
This patch should have been a part of r16-6348-g4dfa48077e3892 but
unfortunately I forgot to bump these versions with it.

Bootstrapped and regtested on aarch64-linux-gnu.

Signed-off-by: Dhruv Chawla <dhruvc@nvidia.com>

gcc/ChangeLog:

	* Makefile.in (all.fda): Bump profile_merger gcov_version to 3.

gcc/c/ChangeLog:

	* Make-lang.in (cc1.fda): Likewise.

gcc/cp/ChangeLog:

	* Make-lang.in (cc1plus.fda): Likewise.

gcc/lto/ChangeLog:

	* Make-lang.in (lto1.fda): Likewise.
2026-02-13 10:28:53 +05:30
GCC Administrator
efc76a7f33 Daily bump. 2026-02-13 00:16:32 +00:00
Andrew Pinski
bfeb09e591 c: Handle REALPART_EXPR and IMAGPART_EXPR in fold_offsetof [PR105555]
In some cases the C front-end calls into fold_offsetof to fold
an address but that does not handle REALPART_EXPR nor IMAGPART_EXPR so
gcc produces an internal compiler error. For offsetof, REALPART_EXPR/IMAGPART_EXPR
won't show up which is why they were not there before.

Bootstrapped and tested on x86_64-linux-gnu.

	PR c/105555

gcc/c-family/ChangeLog:

	* c-common.cc (fold_offsetof): Handle REALPART_EXPR
	and IMAGPART_EXPR.

gcc/testsuite/ChangeLog:

	* gcc.dg/complex-10.c: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2026-02-12 15:23:37 -08:00
Patrick Palka
12f461009b c++: constrained auto NTTP vs associated constraints
According to [temp.param], the constraint on an auto NTTP is an
associated constraint and so should be checked as part of satisfaction
of the overall associated constraints, but we currently don't include
them in the template's associated constraints and instead check them
separately during template argument coercion/deduction.

Fixing this is mostly a matter of storing the NTTP's constraint inside
TEMPLATE_PARM_CONSTRAINTS instead of PLACEHOLDER_TYPE_CONSTRAINTS and
generalizing the relevant template parameter processing subroutines to
also handle such NTTPs.

While this is straightfoward for "simple" constrained autos, it was
later noticed that for e.g. 'C auto* P' or 'D auto& Q' it's not clear
how to express their constraint as an associated constraint.  For P an
option would be C<decltype(*P)>, but for Q it's not clear how to pass
the referenced type to C.  C<decltype(auto(Q))> would be wrong because
we don't want to decay function/array types.

So this patch sidesteps this question by preserving the existing
behavior for such "non-simple" constrained auto (i.e. don't add them
to the associated constraints, and continue ad-hoc checking them during
do_auto_deduction).  The simple case is by far the most common anyway.

The main observeable difference with this change is that such
constrained auto NTTPs are now involved in the "more constrained"
determination during partial ordering.

gcc/cp/ChangeLog:

	* constraint.cc (finish_shorthand_constraint): Add is_non_type
	parameter.  Handle constrained auto NTTPs.
	* cp-tree.h (copy_template_args): Declare.
	(expand_template_argument_pack): Declare.
	(finish_shorthand_constraint): Adjust declaration.
	* mangle.cc (write_template_param_decl): Obtain constraints of
	an auto NTTP through TEMPLATE_PARM_CONSTRAINTS instead of
	PLACEHOLDER_TYPE_CONSTRAINTS.
	* parser.cc (cp_parser_constrained_type_template_parm): Inline
	into its only caller and remove.
	(cp_parser_constrained_non_type_template_parm): Likewise.
	(finish_constrained_parameter): Simplify after the above.  Replace
	the type of an ordinary constrained auto NTTP with a
	non-constrained one and set TEMPLATE_PARM_CONSTRAINTS for it.
	(cp_parser_template_parameter): Dispatch to
	finish_constrained_parameter for a constrained auto NTTP.
	* pt.cc (process_template_parm): Pass is_non_type to
	finish_shorthand_constraint.  Use TEMPLATE_PARM_CONSTRAINTS
	instead of TREE_TYPE for clarity.
	(expand_template_argument_pack): Remove forward declaration.
	(copy_template_args): Likewise.
	(make_constrained_placeholder_type): Return the type not the
	TYPE_NAME for consistency with make_auto_1 etc.
	(do_auto_deduction): Assert we no longer see simple constrained
	autos during coercion/deduction.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp26/pack-indexing15.C: Adjust expected error upon
	constrained auto NTTP satisfaction failure.
	* g++.dg/cpp2a/concepts-placeholder12.C: Likewise.
	* g++.dg/cpp2a/concepts-pr97093.C: Likewise.
	* g++.dg/cpp2a/concepts-template-parm2.C: Likewise.
	* g++.dg/cpp2a/concepts-template-parm6.C: Likewise.
	* g++.dg/cpp2a/concepts-template-parm12.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
2026-02-12 18:20:36 -05:00
Robert Dubner
9db703c556 cobol: Eliminate strict-aliasing violations. [PR121499]
Code violating strict aliasing has been refactored.

libgcobol is now being built with
-fstrict-aliasing -Wstrict-aliasing -Wstrict-aliasing=3

Copyright boilerplate has been updated to the year 2026 throughout gcc/cobol
and libgcobol.

gcc/cobol/ChangeLog:

	* cbldiag.h: Copyright updated to 2026.
	* cdf-copy.cc: Likewise.
	* cdf.y: Likewise.
	* cdfval.h: Likewise.
	* cobol-system.h: Likewise.
	* convert.cc: Likewise.
	* copybook.h: Likewise.
	* except.cc: Likewise.
	* exceptg.h: Likewise.
	* genapi.cc: Likewise.
	* genapi.h: Likewise.
	* gengen.cc: Likewise.
	* gengen.h: Likewise.
	* genmath.cc: Likewise.
	* genmath.h: Likewise.
	* genutil.cc: Likewise.
	* genutil.h: Likewise.
	* inspect.h: Likewise.
	* lang-specs.h: Likewise.
	* lexio.cc: Likewise.
	* lexio.h: Likewise.
	* messages.cc: Likewise.
	* parse.y: Likewise.
	* parse_ante.h: Likewise.
	* parse_util.h: Likewise.
	* scan.l: Likewise.
	* scan_ante.h: Likewise.
	* scan_post.h: Likewise.
	* show_parse.h: Likewise.
	* structs.cc: Likewise.
	* structs.h: Likewise.
	* symbols.cc: Likewise.
	* symbols.h: Likewise.
	* symfind.cc: Likewise.
	* util.cc: Likewise.
	* util.h: Likewise.

libgcobol/ChangeLog:

	PR cobol/121499
	* LICENSE: Copyright updated to 2026.
	* Makefile.am: Compile with -fstrict-aliasing.
	* Makefile.in: Autoreconf.
	* acinclude.m4: Copyright updated to 2026.
	* charmaps.cc: Likewise.
	* charmaps.h: Likewise.
	* common-defs.h: Likewise.
	* configure.tgt: Likewise.
	* constants.cc: Likewise.
	* ec.h: Likewise.
	* encodings.h: Likewise.
	* exceptl.h: Likewise.
	* gcobolio.h: Likewise.
	* gfileio.cc: Likewise.
	* gfileio.h: Likewise.
	* gmath.cc (multiply_int256_by_int64): Eliminate aliasing.
	(divide_int256_by_int64): Likewise.
	(multiply_int128_by_int128): Likewise.
	(divide_int128_by_int128): Likewise.
	* gmath.h: Copyright updated to 2026.
	* intrinsic.cc: Likewise.
	* io.cc: Likewise.
	* io.h: Likewise.
	* libgcobol.cc: Likewise.
	* libgcobol.h: Likewise.
	* stringbin.cc: Likewise.
	* stringbin.h: Likewise.
	* valconv.cc: Likewise.
	* valconv.h: Likewise.
	* xmlparse.cc: Likewise.
2026-02-12 15:38:54 -05:00
Patrick Palka
0852c2d9d7 libstdc++/regex: Avoid -Wunused-parameter warnings in _Executor
Now that _Executor is non-recursive most subroutines no longer use their
_Match_mode parameter (previously it was just passed to recursive _M_dfs
calls).  For now, just make them unnamed to avoid warnings.

libstdc++-v3/ChangeLog:

	* include/bits/regex_executor.tcc (_Executor::_M_rep_once_more):
	Make unnused _Match_mode parameter unnamed.
	(_Executor::_M_handle_repeat): Likewise.
	(_Executor::_M_handle_subexpr_begin): Likewise.
	(_Executor::_M_handle_subexpr_end): Likewise.
	(_Executor::_M_handle_line_begin_assertion): Likewise.
	(_Executor::_M_handle_line_end_assertion): Likewise.
	(_Executor::_M_handle_match): Likewise.
	(_Executor::_M_handle_backref): Likewise.
	(_Executor::_M_handle_alternative): Likewise.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
2026-02-12 15:17:57 -05:00
Patrick Palka
26713009e1 c++: adjust comment from previous commit r16-7487
The comment from r16-7487 is confused, the object argument of PMF
calls _must_ be sequenced first by [expr.call]/7 since syntactically
it appears in the postfix-expression: (a.*pmf)(...).

It's indirect calls to a (known) xobj memfn that don't need such
sequencing, since syntactically the object argument isn't in the
postfix-expression: (&A::f)(a, ...).

gcc/cp/ChangeLog:

	* cp-gimplify.cc (cp_gimplify_expr) <case CALL_EXPR>: Adjust
	r16-7487 comment.
2026-02-12 15:14:11 -05:00
Patrick Palka
0d51ed1950 c++: evaluation order of xobj memfn call [PR123989]
The object argument of an xobj memfn call needs to be evaluated before its
formal arguments, like with an iobj memfn call.  This patch generalizes the
existing such handling in cp_gimplify_expr for METHOD_TYPE callees to also
accept xobj memfn callees.

	PR c++/123989

gcc/cp/ChangeLog:

	* cp-gimplify.cc (cp_gimplify_expr) <case CALL_EXPR>: Evaluate
	the object argument of an xobj memfn call first too.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp23/explicit-obj-eval-order.C: New test.

Reviewed-by: Marek Polacek <polacek@redhat.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
2026-02-12 14:44:56 -05:00
Xi Ruoyao
1a0b276f69 libstdc++: Don't test for __unused on Glibc targets
x86_64 glibc has started to use it since the 2.43 release, but is
expected to fix it before the 2.44 release.

Link: https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b9579342c68b#patch67

libstdc++-v3/ChangeLog:

	* testsuite/17_intro/badnames.cc (__unused): Do not define.
	* testsuite/17_intro/names.cc [glibc == 2.43] (__unused): Undef.

Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
2026-02-12 19:36:28 +00:00
Jonathan Wakely
db072f75e5 libstdc++: Fix fallback definitions of std::is_member_*_pointer
When the builtins aren't used we need a declaration of std::is_function
for the fallback definitions of std::is_member_function_pointer and
std::is_member_object_pointer.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (is_function): Declare before first
	use.
2026-02-12 19:36:16 +00:00
Hans-Peter Nilsson
e4c21d8485 CRIS: Make sure cstore<mode>4, cbranch<mode>4 don't have two memory operands
Yet more testing showed that compare insns too, were prone to catching
double-memory operands, for example with
c-c++-common/vector-compare-3.c -O2, from gcc.dg.  So, better try to
fix them, helping current and future optimization passes that are
reluctant or unable to operate on patterns with two memory operands.
This just happens at expansion time by hacking the force_reg stuff to
conveniently happen in the operand-massaging function
cris_reduce_compare.  Together, this and the two previous CRIS patches
did improve coremark results, but by a miniscule factor: speed by
0.002% (from 4887074 to 4886993 cycles) and size by 0.1% (code from
58199 to 58143 bytes) and as you can see, with rounding doing heavy
lifting.

	* config/cris/cris.cc (cris_reduce_compare): Add forcing the first
	operand to be a register, unless the second operand is 0, to scope.
	* config/cris/cris.md ("*cstore<mode><code>4")
	("*cbranch<mode><code>4"): Add guards to condition, for either operand
	to be a register unless the last operand is zero.
2026-02-12 19:34:11 +01:00
Hans-Peter Nilsson
6fdd184731 CRIS: For HI, QI, make sure move patterns don't have two memory operands
Further testing showed that the two-memory-operands case that could
happen for movsf happened for the HI and QI modes as well, for example
in gcc.dg/Wrestrict-5.c.  So, for improved performance they'd better
get guards as well.  The movstrict<m> case is just tagging along for
summetry; I don't know of test-cases that expose that.

	* config/cris/cris.md (BWDSF): New mode_iterator replacing SISF.
	All callers changed.
	("*movhi_internal<setcc><setnz><setnzvc>"): Anonymized from
	"<acc><anz><anzvc>movhi<setcc><setnz><setnzvc>" to make it a
	match-only pattern.  Add conditions to guard from source and
	destination both being memory operands.
	("*movstricthi_internal", "*movstrictqi_internal"): Similarly
	for "movstricthi" and "movstrictqi".
	("movstrict<mode>"): Add common expander for BW, forcing one operand
	to be a register or source being zero.
2026-02-12 19:33:18 +01:00
Hans-Peter Nilsson
5bae3e8edc CRIS: Make sure movsf doesn't have two memory operands
Experimenting, I noticed movsf could get two memory operands, and
when the pass I was hacking, adjusted both operands, the rtl-ssa
framework didn't like the situation and signalled failure, for
example compiling gcc.c-torture/compile/pr85945.c.  While that's
arguably a wart in rtl-ssa and may be a problem by itself, this
shouldn't happen: one operand should be either a register or
constant 0.  It usually doesn't matter because RA fixes up
operands per the constraints.  Still, this is low-handing fruit
for improved performance, letting the RTL passes work on more
correct information ...and also, a plausible excuse for not also
hacking rtl-ssa proper.  Either way, the port is responsible for
guarding operand validity, so tweak it.  Incidental observation:
the two-memory-operands case happened already at expand time.
This mem-to-mem situation doesn't happen for movsi, because it has
special precautions to keep one operand a register or const_int 0,
which were added for reasons of condition-code handling.  That
particular condition, checking for REG_P or the subreg being REG_P
looks too restrictive though, not allowing the (subreg mem) case
that register_operand deliberately allows.

	* config/cris/cris.md (SISF): New mode_iterator for SI and SF.
	("mov<mode>"): Make "movsi" a define_expand to include SFmode by
	means of the SISF iterator and adjust to also handle SFmode.
	("*movsf_internal"): Anonymize "movsf"; make it a match-only pattern.
	Add conditions to guard from source and destination both being memory
	operands.
2026-02-12 19:32:22 +01:00
Kwok Cheung Yeung
6eec7a3687 openmp: Allocate memory for private/firstprivate clauses as directed by allocate clauses in target constructs [PR113436]
This patch generates calls to GOMP_alloc to allocate memory for firstprivate
and private clauses on target constructs with an allocator and alignment
as specified by the allocate clause.

The decl values of the clause need to be adjusted to refer to the allocated
memory, and the initial values of variables need to be copied into the
allocated space for firstprivate variables.

For variable-length arrays, the size of the array is stored in a separate
variable, so the allocation and initialization need to be delayed until the
size is made available on the target.

gcc/

	PR middle-end/113436
	* omp-low.cc (is_variable_sized): Add extra is_ref argument.  Check
	referenced type if true.
	(lower_omp_target): Call lower_private_allocate to generate code to
	allocate memory for firstprivate/private clauses with allocators, and
	insert code after dependent variables have been initialized.
	Construct calls to free allocate memory and insert after target block.
	Adjust decl values for clause variables.  Copy value of firstprivate
	variables to allocated memory.

gcc/testsuite/

	PR middle-end/113436
	* c-c++-common/gomp/pr113436-1.c: New.
	* c-c++-common/gomp/pr113436-2.c: New.
	* g++.dg/gomp/pr113436.C: New.
	* gfortran.dg/gomp/pr113436-1.f90: New.
	* gfortran.dg/gomp/pr113436-2.f90: New.
	* gfortran.dg/gomp/pr113436-3.f90: New.
	* gfortran.dg/gomp/pr113436-4.f90: New.

libgomp/

	PR middle-end/113436
	* libgomp.texi (OpenMP 5.0): Mark allocate clause as implemented.
	(Memory allocation): Add documentation for use in target construct.
	* testsuite/libgomp.c++/firstprivate-1.C: Enable alignment check.
	* testsuite/libgomp.c++/pr113436-1.C: New.
	* testsuite/libgomp.c++/pr113436-2.C: New.
	* testsuite/libgomp.c++/private-1.C: Enable alignment check.
	* testsuite/libgomp.c-c++-common/pr113436-1.c: New.
	* testsuite/libgomp.c-c++-common/pr113436-2.c: New.
	* testsuite/libgomp.fortran/pr113436-1.f90: New.
	* testsuite/libgomp.fortran/pr113436-2.f90: New.
2026-02-12 16:47:39 +00:00
Robert Dubner
e0bbad05ca cobol: Repair CALL ... USING BY VALUE.
These changes cause CALL ... USING BY VALUE to work properly for a
wider range of COBOL variables types, values, and sizes.  Some sizes
of numeric-display variables didn't work, some didn't work for negative
values, and floating-extended didn't work at all.  Now they do.

Fourteen new DejaGnu tests cover this repaired capability.

gcc/cobol/ChangeLog:

	* genapi.cc (establish_using): Use a 128-bit type for
	float-extended; handle numeric-edited values of different sizes
	and signs correctly.
	(create_and_call):  Use a 128-bit type for float-extended.

libgcobol/ChangeLog:

	* Makefile.am: Temporarily continue to use -fno-strict-aliasing.
	* Makefile.in: Likewise.
	* libgcobol.cc (__gg__fetch_call_by_value_value): Simplify handling
	of FldFloat.
	(__gg__assign_value_from_stack): Likewise.
	(__gg__unstring): Avoid uninitialized variable error.
	(__gg__look_at_int128): New function useful for debugging.
	(__gg__look_at_pointer): Likewise.
	* xmlparse.cc (xml_event): Implement namespace XML.
	(cdataBlock): Likewise.
	(characters): Likewise.
	(__gg__xml_parse):  Likewise.

gcc/testsuite/ChangeLog:

	* cobol.dg/group2/USING_COMP-3_BY_REFERENCE.cob: New test.
	* cobol.dg/group2/USING_COMP-3_BY_REFERENCE.out: New test.
	* cobol.dg/group2/USING_COMP-3_BY_VALUE.cob: New test.
	* cobol.dg/group2/USING_COMP-3_BY_VALUE.out: New test.
	* cobol.dg/group2/USING_FLOAT-SLX_BY_REFERENCE.cob: New test.
	* cobol.dg/group2/USING_FLOAT-SLX_BY_REFERENCE.out: New test.
	* cobol.dg/group2/USING_FLOAT-SLX_BY_VALUE.cob: New test.
	* cobol.dg/group2/USING_FLOAT-SLX_BY_VALUE.out: New test.
	* cobol.dg/group2/USING_NumericDisplay_BY_REFERENCE.cob: New test.
	* cobol.dg/group2/USING_NumericDisplay_BY_REFERENCE.out: New test.
	* cobol.dg/group2/USING_NumericDisplay_BY_VALUE.cob: New test.
	* cobol.dg/group2/USING_NumericDisplay_BY_VALUE.out: New test.
	* cobol.dg/group2/USING_Signed_-_COMP-3_BY_REFERENCE.cob: New test.
	* cobol.dg/group2/USING_Signed_-_COMP-3_BY_REFERENCE.out: New test.
	* cobol.dg/group2/USING_Signed_-_COMP-3_BY_VALUE.cob: New test.
	* cobol.dg/group2/USING_Signed_-_COMP-3_BY_VALUE.out: New test.
	* cobol.dg/group2/USING_Signed_-_NumericDisplay_BY_REFERENCE.cob: New test.
	* cobol.dg/group2/USING_Signed_-_NumericDisplay_BY_REFERENCE.out: New test.
	* cobol.dg/group2/USING_Signed_-_NumericDisplay_BY_VALUE.cob: New test.
	* cobol.dg/group2/USING_Signed_-_NumericDisplay_BY_VALUE.out: New test.
	* cobol.dg/group2/USING_Signed___COMP-3_BY_REFERENCE.cob: New test.
	* cobol.dg/group2/USING_Signed___COMP-3_BY_REFERENCE.out: New test.
	* cobol.dg/group2/USING_Signed___COMP-3_BY_VALUE.cob: New test.
	* cobol.dg/group2/USING_Signed___COMP-3_BY_VALUE.out: New test.
	* cobol.dg/group2/USING_Signed___NumericDisplay_BY_REFERENCE.cob: New test.
	* cobol.dg/group2/USING_Signed___NumericDisplay_BY_REFERENCE.out: New test.
	* cobol.dg/group2/USING_Signed___NumericDisplay_BY_VALUE.cob: New test.
	* cobol.dg/group2/USING_Signed___NumericDisplay_BY_VALUE.out: New test.
2026-02-12 11:43:08 -05:00
Pietro Monteiro
66ce317036 libitm: Fix recent libitm testsuite regression [PR69018]
The commit r16-7202-gb129ff0880c6d1 broke running libitm’s testsuite
using combinations of options because it didn’t clean up all the
global variables set in c++.exp.  Fix the regression by using g++ for
the C++ tests and cleaning up the variables shared between C and C++
tests.

libitm/ChangeLog:
	PR libitm/69018
	* testsuite/lib/libitm.exp (libitm_init): Check
	GXX_UNDER_TEST.  Add "${blddir}/.libs" to
	always_ld_library_path if blddir is not empty.  Use
	"-fdiagnostics-plain-output".  Don't set compiler to GCC_UNDER_TEST.
	* testsuite/libitm.c++/c++.exp: If $blddir is not empty set
	libstdc++_library_path, shlib_ext, lang_include_flags, add
	"${blddir}/${lang_library_paths}" to ld_library_path.
	Unset libstdc++_library_path and shlib_ext if we skip C++
	tests and at the end of the test run.
	* testsuite/libitm.c/c.exp: Update the FSF address to the
	website in the license text. Unset lang_library_paths and
	lang_include_flags.  Set the compiler to $GCC_UNDER_TEST.

Co-authored-by: Jakub Jelinek  <jakub@redhat.com>
Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
2026-02-12 11:34:57 -05:00
LIU Hao
25c18a03de libiberty: Preserve errno across calls to libiberty_vprintf_buffer_size()
The MSVCRT `strtoul()` function resets `errno` to zero upon success. On such
a system, `libiberty_vprintf_buffer_size()` could clobber `errno` like this:

   MINGW64 ~
   $ ld nonexistent.file
   C:\MSYS64\mingw64\bin\ld.exe: cannot find nonexistent.file: No error

libiberty/ChangeLog:

	* vprintf-support.c (do_strtoul): New function.
	(libiberty_vprintf_buffer_size): Replace `strtoul` with `do_strtoul`.

Signed-off-by: LIU Hao <lh_mouse@126.com>
2026-02-12 15:23:12 +00:00