Commit graph

219479 commits

Author SHA1 Message Date
Rainer Orth
45e93925be libgcobol: Use strchr instead of index
valconf.cc doesn't compile on Solaris:

cobol/valconv.cc: In function ‘bool __gg__string_to_numeric_edited(char*, char*, int, int, const char*)’:
cobol/valconv.cc:856:40: error: ‘index’ was not declared in this scope; did you mean ‘Rindex’?
  856 |         const char *decimal_location = index(dest, __gg__decimal_point);      |                                        ^~~~~
     |                                        Rindex

On Solaris, it's only declared in <strings.h>.  While one could get that
included, it's way easier to just use strchr as is already the case in
other instances.

Bootstrapped without regressions on amd64-pc-solaris2.11,
sparcv9-sun-solaris2.11, and x86_64-pc-linux-gnu.

2025-04-08  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	libgcobol:
	* valconv.cc (__gg__string_to_numeric_edited): Use strchr instead
	of index.
2025-04-13 12:46:31 +02:00
Nathaniel Shead
f40e39515e c++/modules: More fixes for merging DECL_MAYBE_DELETED functions
My change in r15-9216 broke the case where we imported an uninstantiated
defaulted function over the top of one we had already finished.  This
patch ensures that we don't error for mismatches in this case.

gcc/cp/ChangeLog:

	* module.cc (trees_in::is_matching_decl): Don't check for
	mismatches when importing a DECL_MAYBE_DELETED function over one
	that's already finished.

gcc/testsuite/ChangeLog:

	* g++.dg/modules/noexcept-4_a.H: New test.
	* g++.dg/modules/noexcept-4_b.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
2025-04-13 20:33:38 +10:00
Nathaniel Shead
714e9020be c++/modules: Give more specific diagnostics in is_matching_decl
This patch also rephrases the diagnostics to talk about "imported
declarations" rather than "global module declarations", since as the
FIXME noted we can also get mismatches with some declarations attached
to modules.  Ideally I'd like to revisit the way this is structured
entirely but that won't be appropriate for GCC 15.

gcc/cp/ChangeLog:

	* module.cc (trees_in::is_matching_decl): Add custom errors for
	different kinds of mismatches.

gcc/testsuite/ChangeLog:

	* g++.dg/modules/lambda-8_b.C: Adjust error.
	* g++.dg/modules/leg-merge-4_c.C: Likewise.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
2025-04-13 20:33:37 +10:00
Stefan Schulze Frielinghaus
171710bec5 s390: Add z17 scheduler description
gcc/ChangeLog:

	* config/s390/s390.cc: Add z17 scheduler description.
	* config/s390/s390.h: Ditto.
	* config/s390/s390.md: Ditto.
	* config/s390/9175.md: New file.
2025-04-13 10:59:18 +02:00
Stefan Schulze Frielinghaus
1b290c16e5 s390: Support z17 processor name
The recently announced IBM z17 processor implements the architecture
already supported as arch15.  This patch adds support for z17 as an
alternative architecture name for arch15.

gcc/ChangeLog:

	* common/config/s390/s390-common.cc: Rename arch15 to z17.
	* config.gcc: Add z17.
	* config/s390/driver-native.cc: Detect z17 machine.
	* config/s390/s390-builtins.def (B_VXE3): Rename arch15 to z17.
	* config/s390/s390-c.cc (s390_resolve_overloaded_builtin): Ditto.
	* config/s390/s390-opts.h (enum processor_type): Ditto.
	* config/s390/s390.cc: Ditto.
	* config/s390/s390.h: Ditto.
	* config/s390/s390.md: Ditto.
	* config/s390/s390.opt: Add z17.
	* doc/invoke.texi: Ditto.
2025-04-13 10:59:18 +02:00
Thomas Koenig
64319b2cca Fix ICE in compare_parameter.
This patch fixes an ICE by setting the typespec of a dummy argument
from a global function if known. plus setting the correct flag.
This also removes the corresponding assert.  I'm not quite sure
that the code with the subroutine attribute can be reached, but
I thought better safe than sorry.

gcc/fortran/ChangeLog:

	PR fortran/119669
	* interface.cc (compare_parameter): Error when mismatch between
	formal argument as subroutine and function.  If the dummy
	argument is a known function, set its typespec.

gcc/testsuite/ChangeLog:

	PR fortran/119669
	* gfortran.dg/interface_59.f90: New test.
2025-04-13 10:23:41 +02:00
GCC Administrator
1fda2deeea Daily bump. 2025-04-13 00:17:09 +00:00
Iain Buclaw
424c6c8803 d: Fix importC cannot find input file __importc_builtins.d [PR119761]
Synchronizes the D runtime library with upstream druntime 09ed02ce56,
and fixes a rename of the importC module missed in the r15-6559 merge.

	PR d/119761

libphobos/ChangeLog:

	* libdruntime/MERGE: Merge upstream druntime 09ed02ce56.
	* libdruntime/Makefile.am (DRUNTIME_DISOURCES): Rename __builtins.di
	to __importc_builtins.di.
	* libdruntime/Makefile.in: Regenerate.
	* libdruntime/__builtins.di: Move to...
	* libdruntime/__importc_builtins.di: ...here.

gcc/testsuite/ChangeLog:

	* gdc.dg/import-c/import-c.exp: New test.
	* gdc.dg/import-c/pr119761.d: New test.
	* gdc.dg/import-c/pr119761c.c: New test.
2025-04-13 01:12:23 +02:00
Iain Buclaw
9a7b6668f8 d: Add option to include imported modules in the compilation [PR109023]
Adds the ability to include imported modules in the compilation, as if
they were given on the command line.  When this option is enabled, all
imported modules are compiled except those that are part of libphobos.

	PR d/109023

gcc/d/ChangeLog:

	* d-compiler.cc: Include dmd/errors.h.
	(Compiler::onImport): Implement.
	* d-lang.cc (d_handle_option): Handle -finclude-imports.
	(d_parse_file): Run semantic on included imports.
	* gdc.texi: Document -finclude-imports.
	* lang.opt: Add finclude-imports.
	* lang.opt.urls: Regenerate.

gcc/testsuite/ChangeLog:

	* gdc.dg/torture/imports/pr109023.d: New test.
	* gdc.dg/torture/pr109023.d: New test.
2025-04-12 22:02:26 +02:00
Iain Buclaw
8a03d014ec d: Fix -fonly= argument only matches when including full path [PR119758]
Using `strcmp' to match the `-fonly=' argument with the input source
file made the feature inflexible to use.  By mistake, the driver was
also found to omit all other modules on the command line as well, which
differed from the documentation on the flag:

    Tell the compiler to parse and run semantic analysis on all modules
    on the command line, but only generate code for the given argument.

New tests added to check the feature, which didn't exist before.

	PR d/119758

gcc/d/ChangeLog:

	* d-lang.cc (d_parse_file): Use endswith in test for -fonly= argument.
	* d-spec.cc (lang_specific_driver): Rework -fonly= and pass all input
	files to the front-end compiler when the option is seen.

gcc/testsuite/ChangeLog:

	* gdc.dg/driver_fonly1.d: New test.
	* gdc.dg/driver_fonly2.d: New test.
	* gdc.dg/driver_fonly3.d: New test.
	* gdc.dg/imports/fonly.d: New test.
2025-04-12 22:02:26 +02:00
Andrew Pinski
359b6128ad testsuite: unxfail ira-shrinkwrap-prep-[12].c for x86_64 [PR117706]
When late combine was enabled for x86_64 (r15-1735-ge62ea4fb8ffcab),
these 2 testcases start to xpass in a similar fashion as when late
combine was added and the testcase was updated for aarch64 not to
xfail them there.

Pushed as obvious after a test to make sure the testcase no longer xpass.

	PR testsuite/117706
gcc/testsuite/ChangeLog:

	* gcc.dg/ira-shrinkwrap-prep-1.c: Unxfail for i?68-*-* and x86_64-*-*.
	* gcc.dg/ira-shrinkwrap-prep-2.c: Likewise.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2025-04-12 12:37:05 -07:00
Patrick Palka
e7bccec33b c++: improve constexpr prvalue folding [PR116416]
This patch improves upon r15-6052-g12de1942a0a673 by performing prvalue
folding with mce_false rather than mce_unknown when it's safe to do so
(i.e. ff_mce_false is set), so that we can also fold temporary initializers
that call is_constant_evaluated etc.

In passing I noticed constexpr-prvalue1.C could more precisely verify the
optimization happened by inspecting what the front end spits out instead
of inspecting the optimized assembly -- that there's no constructor call
doesn't necessarily imply the constructor has been completely folded away,
only that its body has been inlined.

	PR c++/116416

gcc/cp/ChangeLog:

	* constexpr.cc (maybe_constant_init_1): Generalize type of
	of manifestly_const_eval parameter from bool to mce_value.
	(maybe_constant_init): Define 3-parameter version taking a
	manifestly_const_eval instead of bool parameter.
	(cxx_constant_init): Adjust.
	* cp-gimplify.cc (cp_fold_r) <case TARGET_EXPR>: Pass mce_false
	to maybe_constant_init during prvalue folding if ff_mce_false is
	set.
	* cp-tree.h (maybe_constant_init): Declare new overload.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1y/constexpr-prvalue1.C: Adjust to instead inspect
	the 'original' dump.
	* g++.dg/cpp1y/constexpr-prvalue1a.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
2025-04-12 14:06:56 -04:00
Sandra Loosemore
342f1663bf Doc: Explicitly document extensions implied by -march=x86_64 [PR97585]
gcc/ChangeLog
	PR target/97585
	* doc/invoke.texi (x86 Options): Document list of extensions
	supported by -march=x86_64, according to the declaration of
	PTA_X86_64_BASELINE in config/i386/i386.h.
2025-04-12 14:29:21 +00:00
Jakub Jelinek
8b2ceb421f driver: Fix up -freport-bug for ASLR [PR119727]
With --enable-host-pie -freport-bug almost never prepares preprocessed
source and instead emits
The bug is not reproducible, so it is likely a hardware or OS problem.
message even for bogus which are 100% reproducible.
The way -freport-bug works is that it reruns it 3 times, capturing stdout
and stderr from each and then tries to compare the outputs in between
different runs.
The libbacktrace emitted hexadecimal addresses at the start of the lines
can differ between runs due to ASLR, either of the PIE executable, or
even if not PIE if there is some frame with e.g. libc function (say
crash in strlen/memcpy etc.).

The following patch fixes it by ignoring such differences at the start of
the lines.

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

	PR driver/119727
	* gcc.cc (files_equal_p): Rewritten using fopen/fgets/fclose instead
	of open/fstat/read/close.  At the start of lines, ignore lowercase
	hexadecimal addresses followed by space.
2025-04-12 13:15:13 +02:00
Jakub Jelinek
3f9dfb94ea bitintlower: Fix up handling of SSA_NAME copies in coalescing [PR119722]
The following patch is miscompiled, because during the limited
SSA name coalescing the bitintlower pass does we incorrectly don't
register a conflict.
This is on
  <bb 4> [local count: 1073741824]:
  # b_17 = PHI <b_19(3), 8(2)>
  g.4_13 = g;
  _14 = g.4_13 >> 50;
  _15 = (unsigned int) _14;
  _21 = b_17;
  _16 = (unsigned int) _21;
  s_22 = _15 + _16;
  return s_22;
basic block where in the map->bitint bitmap we track 14, 17 and 19.
The build_bitint_stmt_ssa_conflicts "hook" has special code where
it tracks uses at the final statements of mergeable operations, so
e.g. the
  _16 = (unsigned int) _21;
statement is considered to be use of b_17 because _21 is not in
map->bitmap (or large_huge.m_names), i.e. is mergeable.
The problem is that build_ssa_conflict_graph has special code to handle
SSA_NAME copies and _21 = b_17; is gimple_assign_copy_p.  In such cases
it calls live_track_clear_var on the rhs1.  The problem is that
on the above bb, after we note in the _16 = (unsigned int) _21;
stmt we need b_17 the generic code makes us forget that because
of the copy statement, and then build_bitint_stmt_ssa_conflicts
ignores it completely (because _21 is large/huge bitint and is
not in map->bitint, so assumed to be handled by a later stmt in the
bb, for backwards walk like this before this one).
As the b_17 use is ignored, the coalescing thinks it can put
all of b_17, b_19 and _14 into the same partition, which is wrong,
while we can and should coalesce b_17 and b_19, _14 needs to be a different
temporary because b_17 is set before and used after _14 has been written.

The following patch fixes it by handling gimple_assign_copy_p in two
separate spots, move the generic coalesce handling of it after
build_ssa_conflict_graph (where build_ssa_conflict_graph handling
doesn't fall through to that, it does continue after the call) and
inside of build_ssa_conflict_graph it performs it too, but only if
the lhs is not mergeable large/huge bitint.

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

	PR tree-optimization/119722
	* gimple-lower-bitint.h (build_bitint_stmt_ssa_conflicts): Add
	CLEAR argument.
	* gimple-lower-bitint.cc (build_bitint_stmt_ssa_conflicts): Add
	CLEAR argument.  Call clear on gimple_assign_copy_p rhs1 if lhs
	is large/huge bitint unless lhs is not in names.
	* tree-ssa-coalesce.cc (build_ssa_conflict_graph): Adjust
	build_bitint_stmt_ssa_conflicts caller.  Move gimple_assign_copy_p
	handling to after the build_bitint_stmt_ssa_conflicts call.

	* gcc.dg/torture/bitint-77.c: New test.
2025-04-12 13:13:53 +02:00
Jakub Jelinek
7e91bba6d5 tailc, expand: Small incremental tweak to tail call dump [PR119718]
Here is an optional incremental tweak to the previous patch.
Instead of

./xgcc -B ./ -S -O2 -fdump-{tree-tailc,rtl-expand}-details pr119718.c ; grep -B1 '^\(;; \)\?Cannot tail-call:' pr119718.c.*
pr119718.c.222t.tailc-_7 = bar (0);
pr119718.c.222t.tailc:Cannot tail-call: call invocation refers to locals
--
pr119718.c.270r.expand-;; foo (1, 2, 3, 4, 5, 6, 7) [tail call]
pr119718.c.270r.expand:;; Cannot tail-call: callee required more stack slots than the caller

this dumps

./xgcc -B ./ -S -O2 -fdump-{tree-tailc,rtl-expand}-details pr119718.c ; grep '^\(;; \)\?Cannot tail-call:' pr119718.c.*
pr119718.c.222t.tailc:Cannot tail-call: call invocation refers to locals: _7 = bar (0);
pr119718.c.270r.expand:;; Cannot tail-call: callee required more stack slots than the caller: foo (1, 2, 3, 4, 5, 6, 7) [tail call]

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

	PR tree-optimization/119718
	* tree-tailcall.cc (maybe_error_musttail): Dump the GIMPLE at the
	end of the Cannot tail-call line rather than on the line before it.
	* calls.cc (maybe_complain_about_tail_call): Dump the GENERIC
	at the end of the ;; Cannot tail-call line rather than on the
	line before it.
2025-04-12 13:12:56 +02:00
Jakub Jelinek
0562e17bd0 tailc, expand: Tail call -fdump-{tree-tailc,expand-details} changes [PR119718]
The following patch makes some adjustments so that users can analyze what
calls weren't tail called even without using musttail attribute (though I'm
still not convinced it should be a warning, because we don't distinguish
between calls in return call (...); statements vs. calls that just happened
to end up in tail positions because something has been optimized away etc.

E.g. for
int foo (int, int, int, int, int, int, int);
int bar (int);
void qux (int *);

int
baz (int x)
{
  if (x)
    return foo (1, 2, 3, 4, 5, 6, 7);
  else
    {
      int y;
      qux (&y);
      return bar (x);
    }
}
./xgcc -B ./ -S -O2 -fdump-{tree-tailc,rtl-expand}-details pr119718.c ; grep -B1 '^\(;; \)\?Cannot tail-call:' pr119718.c.*
pr119718.c.222t.tailc-_7 = bar (0);
pr119718.c.222t.tailc:Cannot tail-call: call invocation refers to locals
--
pr119718.c.270r.expand-;; foo (1, 2, 3, 4, 5, 6, 7) [tail call]
pr119718.c.270r.expand:;; Cannot tail-call: callee required more stack slots than the caller

The changes are:
1) in tailc pass use wording more consistent with the musttail error wording
2) do it only in *-details dump
3) add similar diagnostics on the expand side, but this time only for the
   CALL_EXPR_TAILCALL calls, if something wasn't marked that way, it is up
   to tailc pass to emit message about it, if it was and it still can't be
   tail called, let it tell users about that; in this case I need
   to use the ;; prefix because it will appear in the middle of
   the IL dump and ;; is what is used for such purposes in other spots
4) I've tried to improve formatting of the maybe_error_musttail and
   maybe_complain_about_tail_call calls

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

	PR tree-optimization/119718
	* tree-tailcall.cc (maybe_error_musttail): Only dump into dump_file
	if dump_flags & TDF_DETAILS.  Use "Cannot tail-call: " prefix instead
	of "Cannot convert: ".
	(find_tail_calls, tree_optimize_tail_calls_1): Formatting fixes
	for maybe_error_musttail calls.
	* calls.cc (maybe_complain_about_tail_call): Emit also a message
	into dump_file when dump_flags & TDF_DETAILS for CALL_EXPR_TAILCALL
	calls.
	(initialize_argument_information): Formatting fix for
	maybe_complain_about_tail_call calls.
	(can_implement_as_sibling_call_p, expand_call): Likewise.
2025-04-12 13:11:59 +02:00
Eric Botcazou
ecef0d7c53 Ada: Natural/Positive not ignored in subprogram renaming
The language says that the profile of a subprogram renaming-as-declaration
must be mode conformant with that of the renamed subprogram, and that the
parameter subtypes are taken from the renamed subprogram.

GNAT implements the rule, except when Natural and Positive are involved,
which may lead to the wrong conclusion that it does not.

gcc/ada/
	PR ada/119643
	* sem_ch8.adb (Inherit_Renamed_Profile): Add guard against the
	peculiarities of Natural and Positive.

gcc/testsuite/
	* gnat.dg/renaming17.adb: New test.
2025-04-12 11:37:53 +02:00
Thomas Schwinge
f417af3f9f Fortran: Add code gen for do,concurrent's LOCAL/LOCAL_INIT: Fix 'static_assert' [PR101602]
Fix-up for commit 2d7e1d6e40
"Fortran: Add code gen for do,concurrent's LOCAL/LOCAL_INIT [PR101602]":

    ../../source-gcc/gcc/fortran/trans-stmt.cc: In function ‘void gfc_trans_concurrent_locality_spec(bool, stmtblock_t*, std::vector<symbol_and_tree_t>*, gfc_expr_list**)’:
    ../../source-gcc/gcc/fortran/trans-stmt.cc:5157:59: error: expected ‘,’ before ‘)’ token
       static_assert (LOCALITY_LOCAL_INIT - LOCALITY_LOCAL == 1);
                                                               ^
    ../../source-gcc/gcc/fortran/trans-stmt.cc:5157:59: error: expected string-literal before ‘)’ token
    make[2]: *** [Makefile:1210: fortran/trans-stmt.o] Error 1

	PR fortran/101602
	gcc/fortran/
	* trans-stmt.cc (gfc_trans_concurrent_locality_spec): Fix
	'static_assert'.
2025-04-12 11:00:56 +02:00
Bob Dubner
711c10383f cobol: Eliminate many getenv() calls. [PR119694]
Many debugging calls to getenv() are eliminated.  The debugging calls that
remain use gcobol_getenv(...) ). Environment variables available to the user
are mostly prefixed "GCOBOL_".

gcc/cobol

	PR cobol/119694
	* cbldiag.h: Eliminate getenv() calls.
	* cdf.y: Likewise.
	* cobol1.cc: Likewise.
	* except.cc: Likewise.
	* genapi.cc: Likewise.
	* lexio.cc: Likewise.
	* parse.y: Likewise.
	* scan_ante.h: Likewise.
	* show_parse.h: Likewise.
	* symbols.cc: Likewise.
	* symfind.cc: Likewise.
	* util.cc: Likewise.

gcc/testsuite

	PR cobol/119694
	* cobol.dg/group2/ACCEPT_DATE___DAY_and_intrinsic_functions__2_.cob: GCOBOL_CURRENT_DATE.
	* cobol.dg/group2/ACCEPT_FROM_TIME___DATE___DAY___DAY-OF-WEEK__2_.cob: Likewise
	* cobol.dg/group2/FUNCTION_DATE___TIME_OMNIBUS.cob: Likewise

libgcobol

	PR cobol/119694
	* gfileio.cc: Eliminate getenv() calls.
	* libgcobol.cc: Likewise.
2025-04-11 22:53:15 -04:00
GCC Administrator
c9d9521af3 Daily bump. 2025-04-12 00:17:42 +00:00
Sandra Loosemore
498933e54d Doc: Correct documentation for -fstrong-eval-order [PR106618]
gcc/ChangeLog
	PR c++/106618
	* doc/invoke.texi (Option Summary): Remove -fargs-in-order, add
	-fstrong-eval-order.
	(C++ Dialect Options): Explicitly document that -fstrong-eval-order
	takes an optional argument and what the choices are.  Generalize
	references to C++17.
2025-04-11 22:24:20 +00:00
Sandra Loosemore
93f6ea8303 Doc: Delete misleading sentence from -frounding-math docs [PR105548]
gcc/ChangeLog
	PR middle-end/105548
	* doc/invoke.texi (Optimize Options): Delete misleading sentence
	about conversions.
2025-04-11 21:23:23 +00:00
Gaius Mulley
985ae5ae9d PR modula2/119735: Remove single quotes from m2 source code comments.
Removing ' from all m2 comments so that make gcc.pot does not
generate any warnings.  Also hide %n from comments.

gcc/m2/ChangeLog:

	PR modula2/119735
	* gm2-compiler/M2MetaError.def: Hide %n from comment.
	* gm2-compiler/SymbolTable.def (PutIncludedByDefinition): Remove '
	from comment.
	* gm2-gcc/m2expr.def (init): Ditto.
	* gm2-libiberty/pexecute.def: Ditto.
	* gm2-libs-coroutines/Executive.def (InitSemaphore): Ditto.
	(Wait): Ditto.
	* gm2-libs-iso/ClientSocket.def: Ditto.
	* gm2-libs-log/BlockOps.def (BlockMoveBackward): Ditto.
	* gm2-libs-log/InOut.def: Ditto.
	* mc/mcFileName.def: Ditto.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-04-11 19:34:17 +01:00
Christophe Lyon
5cc8a75140 testsuite: arm: rename arm_v8_1_lob_ok into arm_v8_1m_lob_hw
All arm effective-targets using check_runtime use the "_hw" or
"_multilib" suffix, so rename arm_v8_1_lob_ok into arm_v8_1m_lob_hw
for consistency.

Since "lob" applies only to M-profile, replace v8_1 with v8_1m in
arm_v8_1_lob_ok, arm_thumb2_no_arm_v8_1_lob and
arm_thumb2_ok_no_arm_v8_1_lob.

gcc/testsuite/ChangeLog

	* lib/target-supports.exp: Rename arm_v8_1_lob_ok into
	arm_v8_1m_lob_hw.
	Rename arm_thumb2_no_arm_v8_1_lob into
	arm_thumb2_no_arm_v8_1m_lob.
	Rename arm_thumb2_ok_no_arm_v8_1_lob into
	arm_thumb2_ok_no_arm_v8_1m_lob.
	* gcc.target/arm/lob1.c: Likewise.
	* gcc.target/arm/lob6.c: Likewise.
	* gcc.target/arm/ivopts.c: Likewise.
	* gcc.target/arm/unsigned-extend-2.c: Likewise.
2025-04-11 16:28:54 +00:00
Andrew Pinski
33b255a1aa testcase: Add testcase for shrink wrapping of vector<int>::push_back [PR118502]
LLVM folks noticed that GCC was shrink wrapping the call to vector<int>::push_back.
So I thought it was a good idea to commit a testcase to make sure GCC does not regress
in this area unknowning.

Note the shrink wrapping started with r15-1619-g3b9b8d6cfdf593.
Note this enables the testcase for x86_64 (!ia32), powerpc, aarch64 and riscv which I tested
via godbolt to see the shrink wrapping occurs. Also tested the testcase for both
x86_64-linux-gnu and aarch64-linux-gnu to make sure I got the target selects correct.

Changes since v1:
* v2: Fix some comments typos that was mentioned in the bug report.

	PR rtl-optimization/118502

gcc/testsuite/ChangeLog:

	* g++.dg/opt/shrink-wrapping-vector-1.C: New test.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2025-04-11 08:58:30 -07:00
Jeff Law
992be16d83 [committed] [RISC-V] Fix testsuite fallout from recent changes
Recent changes have started triggering:

> Tests that now fail, but worked before (3 tests):
>
> unix/-march=rv64gc_zba_zbb_zbs_zicond: gcc: gcc.target/riscv/rvv/base/pr115068-run.c (test for excess errors)
> unix/-march=rv64gc_zba_zbb_zbs_zicond: gcc: gcc.target/riscv/rvv/base/pr115068.c (test for excess errors)
> unix/-march=rv64gc_zba_zbb_zbs_zicond: gcc: gcc.target/riscv/rvv/base/vwaddsub-1.c (test for excess errors)

We're emitting a pedantic diagnostic on the #include_next.  This just turns off the pedantic warnings.

Pushing as obvious.

gcc/testsuite
	* gcc.target/riscv/rvv/base/pr115068-run.c: Turn off pedantic diagnostics.
	* gcc.target/riscv/rvv/base/pr115068.c: Likewise.
	* gcc.target/riscv/rvv/base/vwaddsub-1.c: Likewise.
2025-04-11 08:28:22 -06:00
Jason Merrill
4acdfb71d4 c++: avoid ARM -Wunused-value [PR114970]
Because of the __builtin_is_constant_evaluated, maybe_constant_init in
expand_default_init fails, so the constexpr constructor isn't folded until
cp_fold, which then calls cp_build_init_expr_for_ctor, which builds a
COMPOUND_EXPR in case the enclosing expression is relying on the ARM
behavior of returning 'this'.

As in other places, avoid -Wunused-value on artificial COMPOUND_EXPR.

	PR c++/114970

gcc/cp/ChangeLog:

	* cp-gimplify.cc (cp_build_init_expr_for_ctor): Suppress warnings on
	return_this COMPOUND_EXPR.

gcc/testsuite/ChangeLog:

	* g++.dg/opt/is_constant_evaluated4.C: New test.
2025-04-11 09:53:40 -04:00
Jonathan Wakely
44478b69d7
libstdc++: Add fast_float patch to LOCAL_PATCHES
libstdc++-v3/ChangeLog:

	* src/c++17/fast_float/LOCAL_PATCHES: Update.
2025-04-11 14:21:35 +01:00
Evgeny Karpov
c3ba75f6ac
libstdc++: Support aarch64-w64-mingw32 target in fast_float
This patch resolves the GCC compilation issue for the C++ language
targeting aarch64-w64-mingw32.

The change in fast_float has been upstreamed.
https://github.com/fastfloat/fast_float/pull/269

libstdc++-v3/ChangeLog:

	* src/c++17/fast_float/fast_float.h (full_multiplication):
	Support aarch64-w64-mingw32 target.
2025-04-11 14:18:55 +01:00
Jonathan Wakely
648d5c26e2
libstdc++: Use constexpr-if for std::basic_string::_S_copy_chars
For C++11 and later we can remove four overloads of _S_copy_chars and
use constexpr-if in the generic _S_copy_chars. This simplifies overload
resolution for _S_copy_chars, and also means that we use the optimized
memcpy path for other iterators such as std::vector<char>::iterator.

We still need all the _S_copy_chars overloads to be part of the explicit
instantiation definition, so make them depend on the macro that is
defined by src/c++11/string-inst.cc for that purpose.

For C++98 the _S_copy_chars  overloads are still needed, but the macros
_GLIBCXX_NOEXCEPT and _GLIBCXX20_CONSTEXPR do nothing for C++98, so this
change removes them from those overloads.  When instantiated in
src/c++11/string-inst.cc the removed _GLIBCXX_NOEXCEPT macros would
expand to 'noexcept', but in practice that doesn't make any difference
for those instantiations. At -O2 the instantiations inline all the calls
to _S_copy_chars and the presence or absence of noexcept doesn't change
anything in the generated code.

libstdc++-v3/ChangeLog:

	* include/bits/basic_string.h (_S_copy_chars): Replace overloads
	with constexpr-if and extend optimization to all contiguous
	iterators.
	* src/c++11/string-inst.cc: Extend comment.

Reviewed-by: Tomasz Kaminski <tkaminsk@redhat.com>
2025-04-11 13:17:15 +01:00
Tomasz Kamiński
ae54d8cb51 libstdc++: Define __cpp_lib_containers_ranges in appropriate headers [PR111055]
This is final piece of P1206R7, adding a feature test macros,
as range constructors and member operations are now implemented for
all containers and adaptors.

For consistency with the proposal, all new container operations and
helpers are now defined if __glibcxx_containers_ranges, instead
of __glibcxx_ranges_to_container.

	PR libstdc++/111055

libstdc++-v3/ChangeLog:

	* include/bits/version.def (containers_ranges): Define.
	* include/bits/version.h: Regenerate.
	* include/bits/ranges_base.h (__detail::__container_compatible_range)
	(__detail::__range_to_alloc_type, __detail::__range_mapped_type)
	(__detail::__range_key_type): Depend on __glibcxx_containers_ranges
	instead of __glibcxx_ranges_to_container.
	* include/bits/basic_string.h: Replace __glibcxx_ranges_to_container with
	__glibcxx_containers_ranges.
	* include/bits/cow_string.h: Likewise.
	* include/bits/deque.tcc: Likewise.
	* include/bits/forward_list.h: Likewise.
	* include/bits/stl_bvector.h: Likewise.
	* include/bits/stl_deque.h: Likewise.
	* include/bits/stl_list.h: Likewise.
	* include/bits/stl_map.h: Likewise.
	* include/bits/stl_multimap.h: Likewise.
	* include/bits/stl_multiset.h: Likewise.
	* include/bits/stl_queue.h: Likewise.
	* include/bits/stl_set.h: Likewise.
	* include/bits/stl_stack.h: Likewise.
	* include/bits/stl_vector.h: Likewise.
	* include/bits/unordered_map.h: Likewise.
	* include/bits/unordered_set.h: Likewise.
	* include/bits/vector.tcc: Likewise.
	* include/debug/deque: Likewise.
	* include/debug/forward_list: Likewise.
	* include/debug/list: Likewise.
	* include/debug/map.h: Likewise.
	* include/debug/multimap.h: Likewise.
	* include/debug/multiset.h: Likewise.
	* include/debug/set.h: Likewise.
	* include/debug/unordered_map: Likewise.
	* include/debug/unordered_set: Likewise.
	* include/debug/vector: Likewise.
	* include/std/deque: Provide __cpp_lib_containers_ranges.
	* include/std/forward_list: Likewise.
	* include/std/list: Likewise.
	* include/std/map: Likewise.
	* include/std/queue: Likewise.
	* include/std/set: Likewise.
	* include/std/stack: Likewise.
	* include/std/string: Likewise.
	* include/std/unordered_map: Likewise.
	* include/std/unordered_set: Likewise.
	* include/std/vector: Likewise.
	* testsuite/21_strings/basic_string/cons/from_range.cc: Test for value
	__cpp_lib_containers_ranges.
	* testsuite/23_containers/deque/cons/from_range.cc: Likewise.
	* testsuite/23_containers/forward_list/cons/from_range.cc: Likewise.
	* testsuite/23_containers/list/cons/from_range.cc: Likewise.
	* testsuite/23_containers/map/cons/from_range.cc: Likewise.
	* testsuite/23_containers/multimap/cons/from_range.cc: Likewise.
	* testsuite/23_containers/multiset/cons/from_range.cc: Likewise.
	* testsuite/23_containers/priority_queue/cons_from_range.cc: Likewise.
	* testsuite/23_containers/queue/cons_from_range.cc: Likewise.
	* testsuite/23_containers/set/cons/from_range.cc: Likewise.
	* testsuite/23_containers/stack/cons_from_range.cc: Likewise.
	* testsuite/23_containers/unordered_map/cons/from_range.cc: Likewise.
	* testsuite/23_containers/unordered_multimap/cons/from_range.cc: Likewise.
	* testsuite/23_containers/unordered_multiset/cons/from_range.cc: Likewise.
	* testsuite/23_containers/unordered_set/cons/from_range.cc: Likewise.
	* testsuite/23_containers/vector/bool/cons/from_range.cc: Likewise.
	* testsuite/23_containers/vector/cons/from_range.cc: Likewise.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-04-11 13:56:03 +02:00
Iain Buclaw
b905ce8caf d: Merge upstream dmd 1b34fea478, phobos 40ffbb364
D front-end changes:

	- Import latest fixes from dmd v2.111.1-rc.1.

Phobos changes:

	- Import latest fixes from phobos v2.111.1-rc.1.
	- Restore compatibility with older Linux platforms where
	  `getrandom' is unavailable.

gcc/d/ChangeLog:

	* dmd/MERGE: Merge upstream dmd 1b34fea478.

libphobos/ChangeLog:

	* src/MERGE: Merge upstream phobos 40ffbb364.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Call DRUNTIME_OS_FEATURES.
	* libdruntime/Makefile.am (AM_DFLAGS): Add OS_DFLAGS.
	* libdruntime/Makefile.in: Regenerate.
	* m4/druntime/os.m4 (DRUNTIME_OS_FEATURES): Define.
	* src/Makefile.am: Add OS_DFLAGS.
	* src/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/testsuite_flags.in: Add OS_DFLAGS.
2025-04-11 13:01:19 +02:00
Jonathan Wakely
882d3b319d
libstdc++: Add P1206R7 from_range members to std::string [PR111055]
This is the last piece of P1206R7, adding new members to
std::basic_string.

libstdc++-v3/ChangeLog:

	PR libstdc++/111055
	* include/bits/basic_string.h (_S_copy_range): New function.
	(basic_string(from_range_t, R%%, const Alloc&)): New
	constructor.
	(append_range, assign_range, insert_range, replace_with_range):
	New functions.
	* include/bits/cow_string.h: Likewise.
	* testsuite/21_strings/basic_string/cons/from_range.cc: New
	test.
	* testsuite/21_strings/basic_string/modifiers/append/append_range.cc:
	New test.
	* testsuite/21_strings/basic_string/modifiers/assign/assign_range.cc:
	New test.
	* testsuite/21_strings/basic_string/modifiers/insert/insert_range.cc:
	New test.
	* testsuite/21_strings/basic_string/modifiers/replace/replace_with_range.cc:
	New test.

Co-authored-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-04-11 11:18:30 +01:00
Tomasz Kamiński
3b33d792cf libstdc++: Implement debug format for strings and characters formatters [PR109162]
This patch implements part P2286R8 that specified debug (escaped)
format for the strings and characters sequences. This include both
handling of the '?' format specifier and set_debug_format member.

To indicate partial support we define __glibcxx_format_ranges macro
value 1, without defining __cpp_lib_format_ranges.

We provide two separate escaping routines depending on the literal
encoding for the corresponding character types. If the character
encoding is Unicode, we follow the specification for the standard
(__format::__write_escaped_unicode).
For other encodings, we escape only characters in range [0x00, 0x80),
interpreting them as ASCII values: [0x00, 0x20), 0x7f and  '\t', '\r',
'\n', '\\', '"', '\'' are escaped. We assume every character outside
this range is printable (__format::_write_escaped_ascii).
In particular we do not yet implement special handling of shift
sequences.

For Unicode escaping a new __unicode::__escape_edges table is introduced,
that encodes information if character belongs to General_Category that is
escaped by the standard (Control or Other). This table is generated from
DerivedGeneralCategory.txt provided by Unicode. Only boolean flag is
preserved to reduce the number of entries. The additional rules for escaping
are handled by __format::__should_escape_unicode.

When width or precision is specified, we emit escaped string to the temporary
buffer and format the resulting string according to the format spec.
For characters use a fixed size stack buffer, for which a new _Fixedbuf_sink is
introduced. For strings, we use _Str_sink and to avoid allocations,
we compute the estimated size of (possibly truncated) input, and if it is
larger than width field we print directly.

	PR libstdc++/109162

contrib/ChangeLog:

	* unicode/README: Mentioned DerivedGeneralCategory.txt.
	* unicode/gen_libstdcxx_unicode_data.py: Generation __escape_edges
	table from DerivedGeneralCategory.txt. Update file name in comments.
	* unicode/DerivedGeneralCategory.txt: Copy of file distributed by
	Unicode Consortium.

libstdc++-v3/ChangeLog:

	* include/bits/chrono_io.h (__detail::_Widen): Moved to std/format file.
	* include/bits/unicode-data.h: Regnerate.
	* include/bits/unicode.h (__unicode::_Utf_iterator::_M_units)
	(__unicode::__should_escape_category): Define.
	* include/std/format (_GLIBCXX_WIDEN_, _GLIBCXX_WIDEN):	Copied from
	include/bits/chrono_io.h.
	(__format::_Widen): Moved from include/bits/chrono_io.h.
	(__format::_Term_char, __format::_Escapes, __format::_Separators)
	(__format::__should_escape_ascii, __format::__should_escape_unicode)
	(__format::__write_escape_seq, __format::__write_escaped_char)
	(__format::__write_escaped_acii, __format::__write_escaped_unicode)
	(__format::__write_escaped): Define.
	(__formatter_str::_S_trunc): Extracted truncation of character
	sequences.
	(__formatter_str::format): Handle _Pres_esc.
	(__formatter_int::_M_do_parse) [__glibcxx_format_ranges]: Parse '?'.
	(__formatter_int::_M_format_character_escaped): Define.
	(formatter<_CharT, _CharT>::format, formatter<char, wchar_t>::format):
	Handle _Pres_esc.
	(__formatter_str::set_debug_format, formatter<...>::set_debug_format)
	Guard with __glibcxx_format_ranges.
	(__format::_Fixedbuf_sink): Define.
	* testsuite/23_containers/vector/bool/format.cc: Use __format::_Widen
	and remove unnecessary <chrono> include.
	* testsuite/std/format/debug.cc: New test.
	* testsuite/std/format/debug_nonunicode.cc: New test.
	* testsuite/std/format/parse_ctx.cc (escaped_strings_supported): Define
	to true if __glibcxx_format_ranges is defined.
	* testsuite/std/format/string.cc (escaped_strings_supported): Define to
	true if __glibcxx_format_ranges is defined.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-04-11 08:43:50 +02:00
Jakub Jelinek
b57d7ef4bd bitintlower: Fix up handling of nested casts in m_upward_2limbs cases [PR119707]
The following testcase is miscompiled I believe starting with
PR112941 r14-6742.  That commit fixed the bitint-55.c testcase.
The m_first initialization for such conversion initializes 2 SSA_NAMEs,
one is PHI result on the loop (m_data[save_data_cnt]) and the other
(m_data[save_data_cnt+1]) is the argument of that PHI from the latch
edge initialized somewhere in the loop.  Both of these are used to
propagate sign extension (i.e. either 0 or all ones limb) from the
iteration with the sign bit of a narrower type to following iterations.
The bitint-55.c testcase was ICEing with invalid SSA forms as it was
using unconditionally the PHI argument SSA_NAME even in places which
weren't dominated by that.  And the code which was touched is about
handling constant idx, so if e.g. there are nested casts and the
outer one does conditional code based on index comparison with
a particular constant index.
In the following testcase there are 2 nested casts, one from signed
_BitInt(129) to unsigned _BitInt(255) and the outer from unsigned
_BitInt(255) to unsigned _BitInt(256).  The m_upward_2limbs case which
is used for handling mergeable arithmetics (like +-|&^ and casts etc.)
one loop iteration handles 2 limbs, the first half the even ones, the
second half the odd ones.
And for these 2 conversions, the special one for the inner conversion
on x86_64 is with index 2 where the sign bit of _BitInt(129) is present,
while for the outer one index 3 where we need to mask off the most
significant bit.
The r15-6742 change started using m_data[save_data_cnt] for all constant
indexes if it is still inside of the loop (and it is sign extension).
But that doesn't work correctly for the case where the inner conversion
produces the sign extension limb in the loop for an even index and
the outer conversion needs to special case the immediately next conversion,
because in that case using the PHI result will see still 0 there rather
than the updated value from the handling of previous limb.
So the following patch special cases this and uses the other SSA_NAME.

Commented IL, trying to lower
  _1 = (unsigned _BitInt(255)) y_4(D);
  _2 = (unsigned _BitInt(256)) _1;
  _3 = _2 + x_5(D);
  <retval> = _3;
we were emitting
  <bb 3> [local count: 1073741824]:
  # _8 = PHI <0(2), _9(12)>     // This is the limb index
  # _10 = PHI <0(2), _11(12)>   // Sign extension limb from inner cast (0 or ~0UL)
  # _22 = PHI <0(2), _23(12)>   // Overflow bit from addition of previous limb
  if (_8 <= 2)
    goto <bb 4>; [80.00%]
  else
    goto <bb 7>; [20.00%]

  <bb 4> [local count: 1073741824]:
  if (_8 == 2)
    goto <bb 6>; [20.00%]
  else
    goto <bb 5>; [80.00%]

  <bb 5> [local count: 1073741824]:
  _12 = VIEW_CONVERT_EXPR<unsigned long[3]>(y)[_8];     // Full limbs in y
  goto <bb 7>; [100.00%]

  <bb 6> [local count: 214748360]:
  _13 = MEM <unsigned long> [(_BitInt(129) *)&y + 16B]; // y[2] which
  _14 = (<unnamed-signed:1>) _13;                       // needs to be
  _15 = (unsigned long) _14;                            // sign extended
  _16 = (signed long) _15;                              // to full
  _17 = _16 >> 63;                                      // limb
  _18 = (unsigned long) _17;

  <bb 7> [local count: 1073741824]:
  # _19 = PHI <_12(5), _10(3), _15(6)>  // Limb to add for result of casts
  # _20 = PHI <0(5), _10(3), _18(6)>    // Sign extension limb from previous limb
  _11 = _20;                            // PHI _10 argument above
  _21 = VIEW_CONVERT_EXPR<unsigned long[4]>(x)[_8];
  _24 = .UADDC (_19, _21, _22);
  _25 = IMAGPART_EXPR <_24>;
  _26 = REALPART_EXPR <_24>;
  VIEW_CONVERT_EXPR<unsigned long[4]>(<retval>)[_8] = _26;
  _27 = _8 + 1;
  if (_27 == 3)                 // For the outer cast limb 3 is special
    goto <bb 11>; [20.00%]
  else
    goto <bb 8>; [80.00%]

  <bb 8> [local count: 1073741824]:
  if (_27 < 2)
    goto <bb 9>; [80.00%]
  else
    goto <bb 10>; [20.00%]

  <bb 9> [local count: 1073741824]:
  _28 = VIEW_CONVERT_EXPR<unsigned long[3]>(y)[_27];    // These are used in full

  <bb 10> [local count: 1073741824]:
  # _29 = PHI <_28(9), _11(8)>
  goto <bb 12>; [100.00%]

  <bb 11> [local count: 214748360]:
// And HERE is the actual bug.  Using _10 for idx 3 will mean it is always
// zero there and doesn't contain the _18 value propagated to it.
// It should be
// _30 = (<unnamed-unsigned:63>) _11;
// Now if the outer conversion had special iteration say 5, we could
// have used _10 fine here, by that time it already propagates through
// the PHI.
  _30 = (<unnamed-unsigned:63>) _10;
  _31 = (unsigned long) _30;

  <bb 12> [local count: 1073741824]:
  # _32 = PHI <_29(10), _31(11)>
  _33 = VIEW_CONVERT_EXPR<unsigned long[4]>(x)[_27];
  _34 = .UADDC (_32, _33, _25);
  _23 = IMAGPART_EXPR <_34>;
  _35 = REALPART_EXPR <_34>;
  VIEW_CONVERT_EXPR<unsigned long[4]>(<retval>)[_27] = _35;
  _9 = _8 + 2;
  if (_9 != 4)
    goto <bb 3>; [0.05%]
  else
    goto <bb 13>; [99.95%]

2025-04-11  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/119707
	* gimple-lower-bitint.cc (bitint_large_huge::handle_cast): Only use
	m_data[save_data_cnt] instead of m_data[save_data_cnt + 1] if
	idx is odd and equal to low + 1.  Remember tree_to_uhwi (idx) in
	a temporary instead of calling the function multiple times.

	* gcc.dg/torture/bitint-76.c: New test.
2025-04-11 08:27:55 +02:00
Jennifer Schmitz
f6e6e6d9ba aarch64: Add test case.
This patch adds a test case to the testsuite for PR119706.
The bug was already fixed by
https://gcc.gnu.org/pipermail/gcc-patches/2025-April/680573.html.

OK for mainline?

Signed-off-by: Jennifer Schmitz <jschmitz@nvidia.com>

gcc/testsuite/
	PR tree-optimization/119706
	* g++.target/aarch64/sve/pr119706.C: New test.
2025-04-11 08:24:12 +02:00
Sandra Loosemore
f6b0dc1b1c Doc: Add missing documentation for -ftree-cselim [PR87909]
gcc/ChangeLog
	PR tree-optimization/87909
	* common.opt.urls: Regenerate.
	* doc/invoke.texi (Option Summary): Add -ftree-cselim.
	(Optimize Options): Likewise.
2025-04-11 03:20:38 +00:00
Jonathan Yong
7e6255edeb bf-ms-attrib.c: Fix expected struct size
Both gcc and msvc agree that the struct size should
be 12, gcc is already correct.

Signed-off-by: Jonathan Yong <10walls@gmail.com>

gcc/testsuite/ChangeLog:

	PR target/113633
	* gcc.dg/bf-ms-attrib.c: Fix expected __ms_struct__ layout
	size.
2025-04-11 01:57:27 +00:00
Jonathan Yong
f4cdbd619d realloc-1.c: accept long long in warning for llp64
llp64 targets like mingw-w64 will print:
warning: ignoring return value of ‘void* __builtin_realloc(void*, long long unsigned int)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
Change the regex pattern to accept it.

Signed-off-by: Jonathan Yong <10walls@gmail.com>

gcc/testsuite/ChangeLog:

	* c-c++-common/analyzer/realloc-1.c: Make diagnostic accept
	long long for __builtin_realloc warning.
2025-04-11 01:56:23 +00:00
Sandra Loosemore
0c210fbbd7 Doc: Discourage the use of -ffloat-store [PR14708]
gcc/ChangeLog
	PR middle-end/14708
	* doc/invoke.texi (Optimize Options): List -fexcess-precision
	before -ffloat-store, moving some background discussion to the
	former from the latter.  Recommend using -fexcess-precision=standard
	instead of -ffloat-store.
2025-04-11 01:50:11 +00:00
GCC Administrator
2fb903387b Daily bump. 2025-04-11 00:17:32 +00:00
Jason Merrill
5957b9919c c++: nested lambda capture pack [PR119345]
tsubst_stmt already registers a local capture proxy as a
local_specialization of both an outer capture proxy and the captured
variable; we also need to do that in add_extra_args.

	PR c++/119345

gcc/cp/ChangeLog:

	* pt.cc (add_extra_args): Also register a specialization
	of the captured variable.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/lambda-targ14.C: New test.
2025-04-10 16:10:02 -04:00
Richard Sandiford
733a6a4c11 libgomp: Update SVE tests
The new SVE tests didn't explicitly force SVE to be enabled,
which meant that they wouldn't work on targets that aren't
configured for SVE by default.  The least invasive way of
fixing that is to add a pragma, which works for most tests.
However, for udr-sve.c, the global:

 #pragma omp declare reduction (+:svint32_t: omp_out = svadd_s32_z (svptrue_b32(), omp_in, omp_out)) \
		    initializer (omp_priv = svindex_s32 (0, 0))

does not work with an earlier:

 #pragma GCC target "+sve"

which is interesting, and maybe worthy of a PR if there isn't one
already.  It seems we have to force SVE (and thus an architecture)
on the command line instead.

However, with that fixed, udr-sve.c fails execution.  One problem
seems to be a missing accumulation in for_reduction.  Fixing that
is enough to reach the final inscan_reduction_incl, but that fails
for reasons I haven't investigated yet.  I would need to read up
more to understand what the loop is doing.

It also looks like there might be a missing "+" in simd_reduction:

  #pragma omp simd reduction (+:va, i)
  for (j = 0; j < 16; j++)
    va = svld1_s32 (svptrue_b32 (), a);

  res = svaddv_s32 (svptrue_b32 (), va);

  if (res != 8)
    __builtin_abort ();

since AFAICT the loop is not doing a reduction as things stand.
But perhaps that's deliberate, since it does match the != 8 test.

libgomp/
	* testsuite/libgomp.c-target/aarch64/firstprivate.c: Add +sve pragma.
	* testsuite/libgomp.c-target/aarch64/lastprivate.c: Likewise.
	* testsuite/libgomp.c-target/aarch64/private.c: Likewise.
	* testsuite/libgomp.c-target/aarch64/shared.c: Likewise.
	* testsuite/libgomp.c-target/aarch64/simd-aligned.c: Likewise.
	* testsuite/libgomp.c-target/aarch64/simd-nontemporal.c: Likewise.
	* testsuite/libgomp.c-target/aarch64/threadprivate.c: Likewise.
	* testsuite/libgomp.c-target/aarch64/udr-sve.c: Add an -march option.
	(for_reduction): Use "+=" in the reduction loop.
2025-04-10 21:09:07 +01:00
Patrick Palka
493974aa0a c++: alias_ctad_tweaks ICE w/ inherited CTAD [PR119687]
With inherited CTAD the set of guides may be a two-dimensional overload
set (i.e. OVERLOADs of OVERLOADs) so alias_ctad_tweaks (which also does
the inherited CTAD transformation) needs to use the 2D-aware lkp_iterator
instead of ovl_iterator, or better yet use the more idiomatic lkp_range.

	PR c++/119687

gcc/cp/ChangeLog:

	* pt.cc (alias_ctad_tweaks): Use lkp_range / lkp_iterator
	instead of ovl_iterator.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp23/class-deduction-inherited8.C: New test.

Reviewed-by: Jason Merill <jason@redhat.com>
2025-04-10 15:49:12 -04:00
Jakub Jelinek
1f32b87117 c++: Use G_ instead of _ around cp/errors.cc gcc-internal-format strings [PR119684]
These pp_printf/pp_verbatim format strings should be gcc-internal-format,
they use the pretty-print.cc format specifier handling rather than libc
*printf, but pp_printf/pp_verbatim are intentionally not handled through
exgettext because not everything done through them should be translated
(e.g. its use for dump files shouldn't be).
In addition, composing translatable messages from
"in requirements " and later on "with " might make it harder to be
translated.

I've verified these strings (at least those which don't use format
specifiers added post GCC 4.3 which gettext doesn't handle) are properly
marked as gcc-internal-format in gcc.pot.  The lack of that caused
ICEs on German translation of the "%s%s%sIn instantiation of %q#D:\n"
message because it contained too many %s.

2025-04-10  Jakub Jelinek  <jakub@redhat.com>

	PR translation/119684
	* error.cc (cp_print_error_function): Use G_ instead of _ for
	pp_printf arguments.
	(function_category): Use G_ instead of _.
	(print_instantiation_full_context): Use G_ instead of _ in pp_verbatim
	arguments.
	(print_location): Likewise.
	(print_instantiation_partial_context): Likewise.
	(maybe_print_constexpr_context): Likewise.
	(print_constrained_decl_info): Use G_() around pp_verbatim argument.
	(print_concept_check_info): Likewise.
	(print_constraint_context_head): Likewise.
	(print_requires_expression_info): Likewise.  Merge separate pp_verbatim
	"in requirements " and "with " into one with conditional messages.
2025-04-10 18:39:52 +02:00
Jonathan Wakely
bb323ec8fd
libstdc++: Adjust value of __cpp_lib_constrained_equality for C++20
The P3379R0 bump to __cpp_lib_constrained_equality relates to changes
that only affect std::expected, so there's no reason to define the
updated value in C++20.

This change restores the previous value (202403) for C++20, and only
uses the new value (202411) for C++23 and later.

Also remove the TODO comments, because I correctly predicted that the
final value would be 202411.

libstdc++-v3/ChangeLog:

	* include/bits/version.def (constrained_equality): Only define
	as 202411 for C++23 and later, use 202403 for C++20.
	* include/bits/version.h: Regenerate.
	* testsuite/20_util/expected/equality_constrained.cc: Remove
	TODO comment.
2025-04-10 17:10:33 +01:00
Iain Sandoe
6fd19b2dbd Darwin, libgcobol: Enable for x86_64 Darwin.
Now that we have libquadmath support, we can enable for x86_64, at
least.

libgcobol/ChangeLog:

	* configure.tgt: Enable for x86_64 Darwin.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-04-10 15:15:05 +01:00
Bob Dubner
6ddcbb3ec8 cobol: New testcases for reference modification.
gcc/testsuite

	* cobol.dg/group2/Dynamic_reference_modification.cob: New testcase.
	* cobol.dg/group2/Length_overflow__1_.cob: Likewise.
	* cobol.dg/group2/Length_overflow__2_.cob: Likewise.
	* cobol.dg/group2/Length_overflow_with_offset__1_.cob: Likewise.
	* cobol.dg/group2/Length_overflow_with_offset__2_.cob: Likewise.
	* cobol.dg/group2/Length_overflow_with_offset__3_.cob: Likewise.
	* cobol.dg/group2/Offset_overflow.cob: Likewise.
	* cobol.dg/group2/Offset_underflow.cob: Likewise.
	* cobol.dg/group2/Refmod__comparisons_inside_numeric-display.cob: Likewise.
	* cobol.dg/group2/Refmod_sources_are_figurative_constants.cob: Likewise.
	* cobol.dg/group2/Static_reference_modification.cob: Likewise.
	* cobol.dg/group2/Dynamic_reference_modification.out: New known-good result.
	* cobol.dg/group2/Length_overflow__1_.out: Likewise.
	* cobol.dg/group2/Length_overflow__2_.out: Likewise.
	* cobol.dg/group2/Length_overflow_with_offset__1_.out: Likewise.
	* cobol.dg/group2/Length_overflow_with_offset__2_.out: Likewise.
	* cobol.dg/group2/Length_overflow_with_offset__3_.out: Likewise.
	* cobol.dg/group2/Offset_overflow.out: Likewise.
	* cobol.dg/group2/Offset_underflow.out: Likewise.
	* cobol.dg/group2/Refmod__comparisons_inside_numeric-display.out: Likewise.
	* cobol.dg/group2/Refmod_sources_are_figurative_constants.out: Likewise.
	* cobol.dg/group2/Static_reference_modification.out: Likewise.
2025-04-10 10:10:11 -04:00
Jason Merrill
39892d9618 c++: lambda in constraint of lambda [PR119175]
Here when we went to mangle the constraints of from<0>, the outer lambda has
no mangling scope, but the inner one was treated as having the outer one as
its scope.  And mangling the outer one means mangling its constraints, which
include the inner one.  So infinite recursion.

But a lambda closure type isn't a scope that anything should have for
mangling, the inner lambda should also have no mangling scope.

	PR c++/119175

gcc/cp/ChangeLog:

	* mangle.cc (decl_mangling_context): Look through lambda type.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/concepts-lambda23.C: New test.
2025-04-10 10:04:46 -04:00