]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
7 months agoUpdate copyright years.
Sahil Yeole [Thu, 15 Feb 2024 20:48:44 +0000 (02:18 +0530)] 
Update copyright years.

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>
7 months agogccrs: Add variadic check on function params
0xn4utilus [Wed, 14 Feb 2024 16:49:15 +0000 (22:19 +0530)] 
gccrs: Add variadic check on function params

gcc/rust/ChangeLog:

* checks/errors/rust-ast-validation.cc (ASTValidation::visit):
Add variadic check on all parameters.

gcc/testsuite/ChangeLog:

* rust/compile/issue-2850.rs: New test.

Signed-off-by: 0xn4utilus <gyanendrabanjare8@gmail.com>
7 months agogccrs: Fix lookup of TuplePattern sub-pattern types
Owen Avery [Mon, 12 Feb 2024 23:20:19 +0000 (18:20 -0500)] 
gccrs: Fix lookup of TuplePattern sub-pattern types

gcc/rust/ChangeLog:

* backend/rust-compile-pattern.cc
(CompilePatternLet::visit):
Lookup type of sub-pattern, not tuple pattern itself.

gcc/testsuite/ChangeLog:

* rust/compile/issue-2847-b.rs: New test.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
7 months agogccrs: add powi intrinsics
Marc Poulhiès [Sun, 22 Oct 2023 16:52:22 +0000 (18:52 +0200)] 
gccrs: add powi intrinsics

gcc/rust/ChangeLog:

* backend/rust-builtins.cc
(BuiltinsContext::register_rust_mappings): Add powi and reformat.
* backend/rust-builtins.h: Add missing copyright header.

gcc/testsuite/ChangeLog:

* rust/compile/torture/intrinsics-math.rs: Adjust pow test, add
test for powi.

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
7 months agogccrs: Add testcase for #[rustc_const_stable]
Arthur Cohen [Wed, 7 Feb 2024 08:27:11 +0000 (09:27 +0100)] 
gccrs: Add testcase for #[rustc_const_stable]

To ensure we don't introduce regressions back to issue #2314

gcc/testsuite/ChangeLog:

* rust/compile/rustc_const_stable.rs: New test.

7 months agogccrs: expand: Fix formatting for "macro not found" error
Arthur Cohen [Tue, 6 Feb 2024 16:26:23 +0000 (17:26 +0100)] 
gccrs: expand: Fix formatting for "macro not found" error

gcc/rust/ChangeLog:

* expand/rust-macro-expand.h (struct MacroExpander): Nitpick: fix
formatting of emitted error.

7 months agogccrs: Fix rebinding imports
Owen Avery [Wed, 21 Jun 2023 14:26:30 +0000 (10:26 -0400)] 
gccrs: Fix rebinding imports

gcc/rust/ChangeLog:

* resolve/rust-ast-resolve-item.cc
(flatten_glob): Use Import class.
(flatten_rebind): Likewise.
(flatten_list): Likewise.
(flatten): Likewise.
(flatten_use_dec_to_paths): Likewise.
(flatten_use_dec_to_imports): Likewise.
(ResolveItem::visit): Likewise.
(Import::add_prefix): New.
(rust_flatten_nested_glob): Adjust test.
(rust_flatten_glob): Likewise.
(rust_flatten_rebind_none): Likewise.
(rust_flatten_rebind): Likewise.
(rust_flatten_rebind_nested): Likewise.
(rust_flatten_list): Likewise.
* resolve/rust-ast-resolve-item.h
(class Import): New.

gcc/testsuite/ChangeLog:

* rust/compile/use_2.rs: New test.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
7 months agogccrs: Add testcase for matches!() macro
Arthur Cohen [Tue, 6 Feb 2024 16:01:46 +0000 (17:01 +0100)] 
gccrs: Add testcase for matches!() macro

This adds a testcase for issue #2129.

gcc/testsuite/ChangeLog:

* rust/execute/torture/matches_macro.rs: New test.

7 months agogccrs: Fix typo in RegionConstraints instance
Arthur Cohen [Wed, 7 Feb 2024 14:42:18 +0000 (15:42 +0100)] 
gccrs: Fix typo in RegionConstraints instance

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-implitem.h: Fix typo in field
(region_costraints -> region_constraints).

7 months agoAArch64: remove ls64 from being mandatory on armv8.7-a..
Tamar Christina [Wed, 21 Feb 2024 11:42:53 +0000 (11:42 +0000)] 
AArch64: remove ls64 from being mandatory on armv8.7-a..

The Arm Architectural Reference Manual (Version J.a, section A2.9 on FEAT_LS64)
shows that ls64 is an optional extensions and should not be enabled by default
for Armv8.7-a.

This drops it from the mandatory bits for the architecture and brings GCC inline
with LLVM and the achitecture.

Note that we will not be changing binutils to preserve compatibility with older
released compilers.

gcc/ChangeLog:

* config/aarch64/aarch64-arches.def (AARCH64_ARCH): Remove LS64 from
Armv8.7-a.

gcc/testsuite/ChangeLog:

* g++.target/aarch64/acle/ls64.C: Add +ls64.
* g++.target/aarch64/acle/ls64_lto.C: Likewise.
* gcc.target/aarch64/acle/ls64_lto.c: Likewise.
* gcc.target/aarch64/acle/pr110100.c: Likewise.
* gcc.target/aarch64/acle/pr110132.c: Likewise.
* gcc.target/aarch64/options_set_28.c: Drop check for nols64.
* gcc.target/aarch64/pragma_cpp_predefs_2.c: Correct header checks.

7 months agoAArch64: skip modes_1.f90 [PR107071]
Tamar Christina [Wed, 21 Feb 2024 11:42:13 +0000 (11:42 +0000)] 
AArch64: skip modes_1.f90 [PR107071]

This test has never worked on AArch64 since the day it was committed.  It has
a number of issues that prevent it from working on AArch64:

The testfailures seem to be known and triaged, so until that's fixed there's
no point in running this test.

gcc/testsuite/ChangeLog:

PR fortran/107071
* gfortran.dg/ieee/modes_1.f90: skip aarch64, arm.

7 months agoaarch64: More SME vs -mtrack-speculation
Richard Sandiford [Wed, 21 Feb 2024 11:12:29 +0000 (11:12 +0000)] 
aarch64: More SME vs -mtrack-speculation

The sequence to commit a lazy save includes a branch based on
whether TPIDR2_EL0 is zero.  The code assumed that CBZ could
be used for this, but that instruction is forbidden when
-mtrack-speculation is being used.

gcc/
* config/aarch64/aarch64.cc (aarch64_mode_emit_local_sme_state):
Use aarch64_gen_compare_zero_and_branch rather than emitting
a CBZ directly.

gcc/testsuite/
* gcc.target/aarch64/sme/locally_streaming_1_ts.c: New test.
* gcc.target/aarch64/sme/sibcall_7_ts.c: Likewise.

7 months agoaarch64: Remove duplicated call
Richard Sandiford [Wed, 21 Feb 2024 11:12:29 +0000 (11:12 +0000)] 
aarch64: Remove duplicated call

I noticed while working on another patch that we had a duplicated
call to aarch64_process_target_attr.

gcc/
* config/aarch64/aarch64.cc (aarch64_option_valid_attribute_p):
Remove duplicated call.

7 months agoaarch64: Fix sibcalls involving shared-ZT0 functions
Richard Sandiford [Wed, 21 Feb 2024 11:12:28 +0000 (11:12 +0000)] 
aarch64: Fix sibcalls involving shared-ZT0 functions

In:

  void bar() __arm_inout("za");
  void foo() __arm_inout("za", "zt0") { bar(); }

foo cannot tail-call bar because foo needs to restore ZT0 after
the call.  I'd forgotten to update the ok_for_sibcall rules
to handle this when adding SME2.

Thanks to Sander de Smalen for the spot.

gcc/
* config/aarch64/aarch64.cc (aarch64_function_ok_for_sibcall):
Check that each individual piece of state is shared in the same
way, rather than using an aggregate check for PSTATE.ZA.

gcc/testsuite/
* gcc.target/aarch64/sme/sibcall_9.c: New test.

7 months agoaarch64: Ensure ZT0 is zeroed in a new-ZT0 function
Richard Sandiford [Wed, 21 Feb 2024 11:12:28 +0000 (11:12 +0000)] 
aarch64: Ensure ZT0 is zeroed in a new-ZT0 function

ACLE guarantees that a function like:

  __arm_new("zt0") foo() { ... }

will start with ZT0 equal to zero.  I'd forgotten to enforce that
after commiting a lazy save.  After such a save, we should zero
ZA iff the function has ZA state and zero ZT0 iff the function
has ZT0 state.

gcc/
* config/aarch64/aarch64.cc (aarch64_mode_emit_local_sme_state):
In the code that commits a lazy save, only zero ZA if the function
has ZA state.  Similarly zero ZT0 if the function has ZT0 state.

gcc/testsuite/
* gcc.target/aarch64/sme/zt0_state_5.c (test3): Expect ZT0 rather
than ZA to be zeroed.
(test5): Remove zeroing of ZA.

7 months agoaarch64: Remove the aarch64_commit_lazy_save pattern
Richard Sandiford [Wed, 21 Feb 2024 11:12:27 +0000 (11:12 +0000)] 
aarch64: Remove the aarch64_commit_lazy_save pattern

The main purpose of the aarch64_commit_lazy_save pattern
was to defer insertion of a half-diamond until splitting,
since splitting knew how to create the associated basic blocks.

However, the fix for PR113220 means that mode-switching also
knows how to do that.  This patch therefore removes the pattern
and emits the subinstructions directly.

On its own, this is actually a slight regression, since it
means we keep an unnecessary zero { za }.  But the cases
where that happens are wrong for a different reason, and this
patch is a prerequisite to fixing it.

gcc/
* config/aarch64/aarch64-sme.md (aarch64_commit_lazy_save): Remove,
directly inserting the associated sequence
* config/aarch64/aarch64.cc (aarch64_mode_emit_local_sme_state):
...here instead.

gcc/testsuite/
* gcc.target/aarch64/sme/zt0_state_5.c (test3, test5): Expect
zero { za }s.

7 months agoaarch64: Stack-clash prologues and VG saves [PR113995]
Richard Sandiford [Wed, 21 Feb 2024 11:12:27 +0000 (11:12 +0000)] 
aarch64: Stack-clash prologues and VG saves [PR113995]

This patch fixes an ICE for a combination of:

- -fstack-clash-protection
- a frame that has SVE save slots
- a frame that has no GPR save slots
- a frame that has a VG save slot

The allocation code was folding the SVE save slot allocation into
the initial frame allocation, so that we had one allocation of
size <size of SVE registers> + 16.  But the VG save code itself
expected the allocations to remain separate, since it wants to
store at a constant offset from SP or FP.

The VG save isn't shrink-wrapped and so acts as a probe of the
initial allocations.  It should therefore be safe to keep separate
allocations in this case.

The scans in locally_streaming_1.c expect no stack clash protection,
so the patch forces that and adds a separate compile-only test for
when protection is enabled.

gcc/
PR target/113995
* config/aarch64/aarch64.cc (aarch64_expand_prologue): Don't
fold the SVE allocation into the initial allocation if the
initial allocation includes a VG save.

gcc/testsuite/
PR target/113995
* gcc.target/aarch64/sme/locally_streaming_1.c: Require
-fno-stack-clash-protection.
* gcc.target/aarch64/sme/locally_streaming_1_scp.c: New test.

7 months agoAllow mode-switching to introduce internal loops [PR113220]
Richard Sandiford [Wed, 21 Feb 2024 11:12:26 +0000 (11:12 +0000)] 
Allow mode-switching to introduce internal loops [PR113220]

In this PR, the SME mode-switching code needs to insert a stack-probe
loop for an alloca.  This patch allows the target to do that.

There are two parts to it: allowing loops for insertions in blocks,
and allowing them for insertions on edges.  The former can be handled
entirely within mode-switching itself, by recording which blocks have
had new branches inserted.  The latter requires an extension to
commit_one_edge_insertion.

I think the extension to commit_one_edge_insertion makes logical sense,
since it already explicitly allows internal loops during RTL expansion.
The single-block find_sub_basic_blocks is a relatively recent addition,
so wouldn't have been available when the code was originally written.

The patch also has a small and obvious fix to make the aarch64 emit
hook cope with labels.

I've added specific -fstack-clash-protection versions of all
aarch64-sme.exp tests that previously failed because of this bug.
I've also added -fno-stack-clash-protection to the original versions
of these tests if they contain scans that assume no protection.

gcc/
PR target/113220
* cfgrtl.cc (commit_one_edge_insertion): Handle sequences that
contain jumps even if called after initial RTL expansion.
* mode-switching.cc: Include cfgbuild.h.
(optimize_mode_switching): Allow the sequence returned by the
emit hook to contain internal jumps.  Record which blocks
contain such jumps and split the blocks at the end.
* config/aarch64/aarch64.cc (aarch64_mode_emit): Check for
non-debug insns when scanning the sequence.

gcc/testsuite/
PR target/113220
* gcc.target/aarch64/sme/call_sm_switch_5.c: Add
-fno-stack-clash-protection.
* gcc.target/aarch64/sme/call_sm_switch_5_scp.c: New test.
* gcc.target/aarch64/sme/sibcall_6_scp.c: New test.
* gcc.target/aarch64/sme/za_state_4.c: Add
-fno-stack-clash-protection.
* gcc.target/aarch64/sme/za_state_4_scp.c: New test.
* gcc.target/aarch64/sme/za_state_5.c: Add
-fno-stack-clash-protection.
* gcc.target/aarch64/sme/za_state_5_scp.c: New test.

7 months agoOpenMP/nvptx: support 'arch(nvptx64)' as context selector
Tobias Burnus [Wed, 21 Feb 2024 10:31:43 +0000 (11:31 +0100)] 
OpenMP/nvptx: support 'arch(nvptx64)' as context selector

The main 'arch' context selector for nvptx is, well, 'nvptx';
however, as 'nvptx64' is used as by LLVM, it makes sense
to support it as well.

Note that LLVM has: "The triple architecture can be one of
``nvptx`` (32-bit PTX) or ``nvptx64`` (64-bit PTX)."
GCC effectively only supports the 64bit variant (at least for
offloading). Thus, GCC's 'nvptx' is not quite the same as LLVM's.

The device-compiler part (nvptx_omp_device_kind_arch_isa) uses
TARGET_ABI64 such that nvptx64 is only defined with -m64.

gcc/ChangeLog:

* config/nvptx/gen-omp-device-properties.sh: Add 'nvptx64' to arch.
* config/nvptx/nvptx.cc (nvptx_omp_device_kind_arch_isa): Likewise.

libgomp/ChangeLog:

* libgomp.texi (OpenMP Context Selectors): Add 'nvptx64' as additional
'arch' value for nvptx.

7 months agoIBM Z: Preserve exceptions in autovec-*-signaling-eq.c tests
Ilya Leoshkevich [Mon, 19 Feb 2024 10:51:38 +0000 (11:51 +0100)] 
IBM Z: Preserve exceptions in autovec-*-signaling-eq.c tests

DSE, DCE, and other passes are removing redundant signaling comparisons
from these tests, but the whole point is to check that GCC knows how to
emit them.  Use -fno-delete-dead-exceptions to prevent that.

gcc/testsuite/ChangeLog:

* gcc.target/s390/zvector/autovec-double-signaling-eq.c:
Preserve exceptions.
* gcc.target/s390/zvector/autovec-float-signaling-eq.c:
Likewise.

7 months agopru: Document how -mmcu option uses MCU specs
Dimitar Dimitrov [Thu, 1 Feb 2024 17:19:54 +0000 (19:19 +0200)] 
pru: Document how -mmcu option uses MCU specs

The plan to maintain PRU hardware-specific specs in newlib tree has been
abandoned in favour of a new distinct GIT project.  Update the
documentation accordingly.

gcc/ChangeLog:

* doc/invoke.texi (-mmcu): Add information about MCU specs.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
7 months agopru: Document that arguments are not passed to main with -minrt
Dimitar Dimitrov [Thu, 1 Feb 2024 17:19:54 +0000 (19:19 +0200)] 
pru: Document that arguments are not passed to main with -minrt

The minimal runtime has been documented from the beginning to break some
standard features in order to reduce code size, while keeping
the features required by typical firmware programs.  Document one more
imposed restriction - the main() function must take no arguments.

gcc/ChangeLog:

* doc/invoke.texi (-minrt): Clarify that main
must take no arguments.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
7 months agolibgcc, aarch64: Allow for BE platforms in heap trampolines.
Iain Sandoe [Sun, 18 Feb 2024 06:52:47 +0000 (06:52 +0000)] 
libgcc, aarch64: Allow for BE platforms in heap trampolines.

This arranges that the byte order of the instruction sequences is
independent of the byte order of memory.

libgcc/ChangeLog:

* config/aarch64/heap-trampoline.c
(aarch64_trampoline_insns): Arrange to encode instructions as a
byte array so that the order is independent of memory byte order.
(struct aarch64_trampoline): Likewise.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
7 months agoanalyzer: handle array-initialization from a string_cst [PR113999]
David Malcolm [Wed, 21 Feb 2024 00:44:51 +0000 (19:44 -0500)] 
analyzer: handle array-initialization from a string_cst [PR113999]

gcc/analyzer/ChangeLog:
PR analyzer/113999
* analyzer.h (get_string_cst_size): New decl.
* region-model-manager.cc (get_string_cst_size): New.
(region_model_manager::maybe_get_char_from_string_cst): Treat
single-byte accesses within string_cst but beyond
TREE_STRING_LENGTH as being 0.
* region-model.cc (string_cst_has_null_terminator): Likewise.

gcc/testsuite/ChangeLog:
PR analyzer/113999
* c-c++-common/analyzer/strlen-pr113999.c: New test.
* gcc.dg/analyzer/strlen-1.c: More test coverage.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
7 months agoanalyzer: handle empty ranges in symbolic_byte_range::intersection [PR113998]
David Malcolm [Wed, 21 Feb 2024 00:44:50 +0000 (19:44 -0500)] 
analyzer: handle empty ranges in symbolic_byte_range::intersection [PR113998]

gcc/analyzer/ChangeLog:
PR analyzer/113998
* ranges.cc (symbolic_byte_range::intersection): Handle empty ranges.
(selftest::test_intersects): Add test coverage for empty ranges.

gcc/testsuite/ChangeLog:
PR analyzer/113998
* c-c++-common/analyzer/overlapping-buffers-pr113998.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
7 months agoDaily bump.
GCC Administrator [Wed, 21 Feb 2024 00:17:26 +0000 (00:17 +0000)] 
Daily bump.

7 months agoUpdate cpplib sv.po
Joseph Myers [Tue, 20 Feb 2024 22:54:28 +0000 (22:54 +0000)] 
Update cpplib sv.po

* sv.po: Update.

7 months agolibstdc++: [_GLIBCXX_DEBUG] Fix std::__niter_wrap behavior
François Dumont [Tue, 20 Feb 2024 18:24:47 +0000 (19:24 +0100)] 
libstdc++: [_GLIBCXX_DEBUG] Fix std::__niter_wrap behavior

In _GLIBCXX_DEBUG mode the std::__niter_base can remove 2 layers, the
__gnu_debug::_Safe_iterator<> and the __gnu_cxx::__normal_iterator<>.
When std::__niter_wrap is called to build a __gnu_debug::_Safe_iterator<>
from a __gnu_cxx::__normal_iterator<> we then have a consistency issue
as the difference between the 2 iterators will done on a __normal_iterator
on one side and a C pointer on the other. To avoid this problem call
std::__niter_base on both input iterators.

libstdc++-v3/ChangeLog:

* include/bits/stl_algobase.h (std::__niter_wrap): Add a call to
std::__niter_base on res iterator.

7 months agoFortran: fix passing array component ref to polymorphic procedures
Peter Hill [Tue, 20 Feb 2024 19:42:53 +0000 (20:42 +0100)] 
Fortran: fix passing array component ref to polymorphic procedures

PR fortran/105658

gcc/fortran/ChangeLog:

* trans-expr.cc (gfc_conv_intrinsic_to_class): When passing an
array component reference of intrinsic type to a procedure
with an unlimited polymorphic dummy argument, a temporary
should be created.

gcc/testsuite/ChangeLog:

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

Signed-off-by: Peter Hill <peter.hill@york.ac.uk>
7 months agors6000: Update instruction counts due to combine changes [PR112103]
Peter Bergner [Tue, 20 Feb 2024 19:44:43 +0000 (13:44 -0600)] 
rs6000: Update instruction counts due to combine changes [PR112103]

The PR91865 combine fix changed instruction counts slightly for rlwinm-0.c.
Adjust expected instruction counts accordingly.

2024-02-20  Peter Bergner  <bergner@linux.ibm.com>

gcc/testsuite/
PR target/112103
* gcc.target/powerpc/rlwinm-0.c: Adjust expected instruction counts.

7 months agoaarch64: Allow aarch64-linux-muscl for heap trampolines [PR113971].
Iain Sandoe [Sun, 18 Feb 2024 06:49:26 +0000 (06:49 +0000)] 
aarch64: Allow aarch64-linux-muscl for heap trampolines [PR113971].

This allows the same trampoline pattern to be used on all linux variants
rather than restricting it to linux gnu.

PR target/113971

libgcc/ChangeLog:

* config/aarch64/heap-trampoline.c: Allow all linux variants.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
7 months agoAVR: Use types of exact size and signedness in built-ins.
Georg-Johann Lay [Tue, 20 Feb 2024 13:54:44 +0000 (14:54 +0100)] 
AVR: Use types of exact size and signedness in built-ins.

The AVR built-ins used types like "int" or "char" that don't
have exact signedness or type size which depend on -mint8
and -f[no-][un-]signed-char etc.  As the built-ins are modelling
machine instructions of given type sizes and signedness, also
use according types in their prototypes.

gcc/
* config/avr/builtins.def: Use function prototypes of given size
and signedness.
* config/avr/avr.cc (avr_init_builtins): Adjust types required
by builtins.def.
* doc/extend.texi (AVR Built-in Functions): Adjust accordingly.

7 months agoAVR: extend.texi - Use @defbuiltin to document built-ins.
Georg-Johann Lay [Tue, 20 Feb 2024 12:46:30 +0000 (13:46 +0100)] 
AVR: extend.texi - Use @defbuiltin to document built-ins.

gcc/
* doc/extend.texi (AVR Built-in Functions): Use @defbuiltin
instead of @table.

7 months agobpf: Add documentation for the -mcpu option
Will Hawkins [Tue, 20 Feb 2024 12:33:38 +0000 (13:33 +0100)] 
bpf: Add documentation for the -mcpu option

Add documentation describing the meaning and values for the -mcpu
command-line option.

Tested for bpf-unknown-none on x86_64-linux-gnu host.

gcc/ChangeLog:

* config/bpf/bpf.opt: Add help information for -mcpu.

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
7 months agoaarch64: Fix streaming-compatible code with -mtrack-speculation [PR113805]
Richard Sandiford [Tue, 20 Feb 2024 11:29:06 +0000 (11:29 +0000)] 
aarch64: Fix streaming-compatible code with -mtrack-speculation [PR113805]

This patch makes -mtrack-speculation work on streaming-compatible
functions.  There were two related issues.  The first is that the
streaming-compatible code was using TB(N)Z unconditionally, whereas
those instructions are not allowed with speculation tracking.
That part can be fixed in a similar way to the recent eh_return
fix (PR112987).

The second issue was that the speculation-tracking pass runs
before some of the conditional branches are inserted.  It isn't
safe to insert the branches any earlier, so the patch instead adds
a second speculation-tracking pass that runs afterwards.  The new
pass is only used for streaming-compatible functions.

The testcase is adapted from call_sm_switch_1.c.

gcc/
PR target/113805
* config/aarch64/aarch64-passes.def (pass_late_track_speculation):
New pass.
* config/aarch64/aarch64-protos.h (make_pass_late_track_speculation):
Declare.
* config/aarch64/aarch64.md (is_call): New attribute.
(*and<mode>3nr_compare0): Rename to...
(@aarch64_and<mode>3nr_compare0): ...this.
* config/aarch64/aarch64-sme.md (aarch64_get_sme_state)
(aarch64_tpidr2_save, aarch64_tpidr2_restore): Add is_call attributes.
* config/aarch64/aarch64-speculation.cc: Update file comment to
describe the new late pass.
(aarch64_do_track_speculation): Handle is_call insns like other calls.
(pass_track_speculation): Add an is_late member variable.
(pass_track_speculation::gate): Run the late pass for streaming-
compatible functions and the early pass for other functions.
(make_pass_track_speculation): Update accordingly.
(make_pass_late_track_speculation): New function.
* config/aarch64/aarch64.cc (aarch64_gen_test_and_branch): New
function.
(aarch64_guard_switch_pstate_sm): Use it.

gcc/testsuite/
PR target/113805
* gcc.target/aarch64/sme/call_sm_switch_11.c: New test.

7 months agotestsuite: Fix up analyzer/torture/vector-extract-1.c test for i686 [PR113983]
Jakub Jelinek [Tue, 20 Feb 2024 09:31:46 +0000 (10:31 +0100)] 
testsuite: Fix up analyzer/torture/vector-extract-1.c test for i686 [PR113983]

The testcase fails on i686-linux with
.../gcc/testsuite/gcc.dg/analyzer/torture/vector-extract-1.c:11:1: warning: MMX vector return without MMX enabled changes the ABI [-Wpsabi]
Added -Wno-psabi to silence the warning.

2024-02-20  Jakub Jelinek  <jakub@redhat.com>

PR analyzer/113983
* gcc.dg/analyzer/torture/vector-extract-1.c: Add -Wno-psabi as
dg-additional-options.

7 months agoFix testcase for platform without gnu/stubs-x32.h
liuhongt [Mon, 19 Feb 2024 04:19:35 +0000 (12:19 +0800)] 
Fix testcase for platform without gnu/stubs-x32.h

target maybe_x32 doesn't check if platform has gnu/stubs-x32.h, but
it's included by stdint.h in the testcase.
Adjust testcase: remove stdint.h, use 'typedef long long int64_t'
instead.

gcc/testsuite/ChangeLog:

PR target/113711
* gcc.target/i386/apx-ndd-x32-1.c: Adjust testcase.

7 months agoDaily bump.
GCC Administrator [Tue, 20 Feb 2024 00:17:58 +0000 (00:17 +0000)] 
Daily bump.

7 months agoanalyzer: fix -Wanalyzer-va-arg-type-mismatch false +ve on int types [PR111289]
David Malcolm [Mon, 19 Feb 2024 23:08:05 +0000 (18:08 -0500)] 
analyzer: fix -Wanalyzer-va-arg-type-mismatch false +ve on int types [PR111289]

gcc/analyzer/ChangeLog:
PR analyzer/111289
* varargs.cc (representable_in_integral_type_p): New.
(va_arg_compatible_types_p): Add "arg_sval" param.  Handle integer
types.
(kf_va_arg::impl_call_pre): Pass arg_sval to
va_arg_compatible_types_p.

gcc/testsuite/ChangeLog:
PR analyzer/111289
* c-c++-common/analyzer/stdarg-pr111289-int.c: New test.
* c-c++-common/analyzer/stdarg-pr111289-ptr.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
7 months agoanalyzer, testsuite: add regression test [PR110520]
David Malcolm [Mon, 19 Feb 2024 23:07:59 +0000 (18:07 -0500)] 
analyzer, testsuite: add regression test [PR110520]

gcc/testsuite/ChangeLog:
PR analyzer/110520
* c-c++-common/analyzer/null-deref-pr110520.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
7 months agoanalyzer: Fix maybe_undo_optimize_bit_field_compare vs non-scalar types [PR113983]
Andrew Pinski [Sun, 18 Feb 2024 22:14:23 +0000 (14:14 -0800)] 
analyzer: Fix maybe_undo_optimize_bit_field_compare vs non-scalar types [PR113983]

After r14-6419-g4eaaf7f5a378e8, maybe_undo_optimize_bit_field_compare would ICE on
vector CST but this function really should be checking if we had integer types so
reject non-integral types early on (like it was doing for non-char type before r14-6419-g4eaaf7f5a378e8).

Committed as obvious after build and tested for aarch64-linux-gnu with no regressions.

PR analyzer/113983

gcc/analyzer/ChangeLog:

* region-model-manager.cc (maybe_undo_optimize_bit_field_compare): Reject
non integral types.

gcc/testsuite/ChangeLog:

* gcc.dg/analyzer/torture/vector-extract-1.c: New test.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
7 months agolibstdc++, Darwin: Handle a linker warning [PR112397].
Iain Sandoe [Thu, 8 Feb 2024 17:54:31 +0000 (17:54 +0000)] 
libstdc++, Darwin: Handle a linker warning [PR112397].

Darwin's linker warns when we make a direct branch to code that is
in a weak definition (citing that if a different implementation of
the weak function is chosen by the dynamic linker this would be an
error).

As the analysis in the PR shows, this can happen when we have hot/
cold partitioning and there is an error path that is primarily cold
but makes use of epilogue code in the hot section.  In this simple
case, we can easily deduce that the code is in fact safe; however
that is not something we can realistically implement in the linker.

Since the user-replaceable allocators are implemented using weak
definitions, this is a warning that is frequently flagged up in both
the testsuite and end-user code.

The chosen solution here is to suppress the hot/cold partitioning for
these cases (it is unlikely to impact performance much c.f. the
actual allocation).

PR target/112397

libstdc++-v3/ChangeLog:

* configure: Regenerate.
* configure.ac: Detect if we are building for Darwin.
* libsupc++/Makefile.am: If we are building for Darwin, then
suppress hot/cold partitioning for the array allocators.
* libsupc++/Makefile.in: Regenerated.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
7 months agolibiberty: Fix error return value in pex_unix_exec_child [PR113957].
Iain Sandoe [Fri, 16 Feb 2024 14:42:53 +0000 (14:42 +0000)] 
libiberty: Fix error return value in pex_unix_exec_child [PR113957].

r14-5310-g879cf9ff45d940 introduced some new handling for spawning sub
processes.  The return value from the generic exec_child is examined
and needs to be < 0 to signal an error. However, the unix flavour of
this routine is returning the PID value set from the posix_spawn{p}.

This latter value is undefined per the manual pages for both Darwin
and Linux, and it seems Darwin, at least, sets the value to some
usually positive number (presumably the PID that would have been used
if the fork had succeeded).

The fix proposed here is to set the pid = -1 in the relevant error
paths.

PR other/113957

libiberty/ChangeLog:

* pex-unix.c (pex_unix_exec_child): Set pid = -1 in the error
paths, since that is used to signal an erroneous outcome for
the routine.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
7 months agoaarch64: Register rng builtins with uint64_t pointers.
Iain Sandoe [Tue, 30 Jan 2024 11:04:59 +0000 (11:04 +0000)] 
aarch64: Register rng builtins with uint64_t pointers.

Currently, these are registered as unsigned_intDI_type_node which is not
necessarily the same type definition as uint64_t.  On platforms where these
differ that causes fails in consuming the arm_acle.h header.

gcc/ChangeLog:

* config/aarch64/aarch64-builtins.cc (aarch64_init_rng_builtins):
Register these builtins with a pointer to uint64_t rather than unsigned
DI mode.

7 months agoUpdate cpplib es.po
Joseph Myers [Mon, 19 Feb 2024 18:13:11 +0000 (18:13 +0000)] 
Update cpplib es.po

* es.po: Update.

7 months agoUpdate .po files
Joseph Myers [Mon, 19 Feb 2024 17:45:19 +0000 (17:45 +0000)] 
Update .po files

gcc/po/
* be.po, da.po, de.po, el.po, es.po, fi.po, fr.po, hr.po, id.po,
ja.po, nl.po, ru.po, sr.po, sv.po, tr.po, uk.po, vi.po, zh_CN.po,
zh_TW.po: Update.

libcpp/po/
* be.po, ca.po, da.po, de.po, el.po, eo.po, es.po, fi.po, fr.po,
id.po, ja.po, ka.po, nl.po, pt_BR.po, ro.po, ru.po, sr.po, sv.po,
tr.po, uk.po, vi.po, zh_CN.po, zh_TW.po: Update.

7 months agoGCN: Conditionalize 'define_expand "reduc_<fexpander>_scal_<mode>"' on '!TARGET_RDNA2...
Thomas Schwinge [Fri, 16 Feb 2024 12:04:00 +0000 (13:04 +0100)] 
GCN: Conditionalize 'define_expand "reduc_<fexpander>_scal_<mode>"' on '!TARGET_RDNA2_PLUS' [PR113615]

On top of commit c7ec7bd1c6590cf4eed267feab490288e0b8d691
"amdgcn: add -march=gfx1030 EXPERIMENTAL" conditionalizing
'define_expand "reduc_<reduc_op>_scal_<mode>"' on
'!TARGET_RDNA2' (later: '!TARGET_RDNA2_PLUS'), we then did similar in
commit 7cc2262ec9a410dc56d1c1c6b950c922e14f621d
"gcn/gcn-valu.md: Disable fold_left_plus for TARGET_RDNA2_PLUS [PR113615]"
to conditionalize 'define_expand "fold_left_plus_<mode>"' on
'!TARGET_RDNA2_PLUS', but I found we also need to conditionalize the related
'define_expand "reduc_<fexpander>_scal_<mode>"' on '!TARGET_RDNA2_PLUS', to
avoid ICEs like:

    [...]/gcc.dg/vect/pr108608.c: In function 'foo':
    [...]/gcc.dg/vect/pr108608.c:9:1: error: unrecognizable insn:
    (insn 34 33 35 2 (set (reg:V64DF 723)
            (unspec:V64DF [
                    (reg:V64DF 690 [ vect_m_11.20 ])
                    (const_int 1 [0x1])
                ] UNSPEC_MOV_DPP_SHR)) -1
         (nil))
    during RTL pass: vregs

Similar for 'gcc.dg/vect/vect-fmax-2.c', 'gcc.dg/vect/vect-fmin-2.c', and
'UNSPEC_SMAX_DPP_SHR' for 'gcc.dg/vect/vect-fmax-1.c', and
'UNSPEC_SMIN_DPP_SHR' for 'gcc.dg/vect/vect-fmin-1.c', when running 'vect.exp'
for 'check-gcc-c'.

PR target/113615
gcc/
* config/gcn/gcn-valu.md (define_expand "reduc_<fexpander>_scal_<mode>"):
Conditionalize on '!TARGET_RDNA2_PLUS'.
* config/gcn/gcn.cc (gcn_expand_dpp_shr_insn)
(gcn_expand_reduc_scalar):
'gcc_checking_assert (!TARGET_RDNA2_PLUS);'.

7 months agoGCN: Restore lost '__gfx90a__' target CPU definition
Thomas Schwinge [Thu, 8 Feb 2024 22:27:19 +0000 (23:27 +0100)] 
GCN: Restore lost '__gfx90a__' target CPU definition

Also, add some safeguards for the future.

Fix-up for commit 52a2c659ae6c21f84b6acce0afcb9b93b9dc71a0
"GCN: Add pre-initial support for gfx1100".

gcc/
* config/gcn/gcn.h (TARGET_CPU_CPP_BUILTINS): Restore lost
'__gfx90a__' target CPU definition.  Add some safeguards for the future.

7 months agoc++: compound-requirement partial substitution [PR113966]
Patrick Palka [Mon, 19 Feb 2024 16:34:45 +0000 (11:34 -0500)] 
c++: compound-requirement partial substitution [PR113966]

When partially substituting a requires-expr, we don't want to perform
any additional checks beyond the substitution itself so as to minimize
checking requirements out of order.  So don't check the return-type-req
of a compound-requirement during partial substitution.  And don't check
the noexcept condition either since we can't do that on templated trees.

PR c++/113966

gcc/cp/ChangeLog:

* constraint.cc (tsubst_compound_requirement): Don't check
the noexcept condition or the return-type-requirement when
partially substituting.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-friend17.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
7 months agoFix testism where __seg_gs was being used for all targets
Andre Simoes Dias Vieira [Mon, 19 Feb 2024 15:50:37 +0000 (15:50 +0000)] 
Fix testism where __seg_gs was being used for all targets

Replaced uses of __seg_gs with the MACRO SEG defined in the testcase to pick
(if any) the right __seg_{gs,fs} keyword based on target.

gcc/testsuite/ChangeLog:

* gcc.dg/bitint-86.c (__seg_gs): Replace with SEG MACRO.

7 months agortl-optimization/54052 - RTL SSA PHI insertion compile-time hog
Richard Biener [Mon, 19 Feb 2024 10:10:50 +0000 (11:10 +0100)] 
rtl-optimization/54052 - RTL SSA PHI insertion compile-time hog

The following tries to address the PHI insertion compile-time hog in
RTL fwprop observed with the PR54052 testcase where the loop computing
the "unfiltered" set of variables possibly needing PHI nodes for each
block exhibits quadratic compile-time and memory-use.

It does so by pruning the local DEFs with LR_OUT of the block, removing
regs that can never be LR_IN (defined by this block) in the dominance
frontier.

PR rtl-optimization/54052
* rtl-ssa/blocks.cc (function_info::place_phis): Filter
local defs by LR_OUT.

7 months agoPR modula2/113889 Incorrect constant string value if declared in a definition module
Gaius Mulley [Mon, 19 Feb 2024 12:59:36 +0000 (12:59 +0000)] 
PR modula2/113889 Incorrect constant string value if declared in a definition module

This patch fixes a bug exposed when a constant string is declared in a
definition module and imported by a program module.  The bug fix
was to defer the string assignment and concatenation until quadruples
were generated.  The conststring symbol has a known field which
must be checked prior to retrieving the string contents.

gcc/m2/ChangeLog:

PR modula2/113889
* gm2-compiler/M2ALU.mod (StringFitsArray): Add tokeno parameter
to GetStringLength.
(InitialiseArrayOfCharWithString): Add tokeno parameter to
GetStringLength.
(CheckGetCharFromString): Add tokeno parameter to GetStringLength.
* gm2-compiler/M2Const.mod (constResolveViaMeta): Replace
PutConstString with PutConstStringKnown.
* gm2-compiler/M2GCCDeclare.mod (DeclareCharConstant): Add tokenno
parameter and add assert.  Use tokenno to generate location.
(DeclareStringConstant): Add tokenno and add asserts.
Add tokenno parameter to calls to GetStringLength.
(PromoteToString): Add assert and add tokenno parameter to
GetStringLength.
(PromoteToCString): Add assert and add tokenno parameter to
GetStringLength.
(DeclareConstString): New procedure function.
(TryDeclareConst): Remove size local variable.
Check IsConstStringKnown.
Call DeclareConstString.
(PrintString): New procedure.
(PrintVerboseFromList): Call PrintString.
(CheckResolveSubrange): Check IsConstStringKnown before creating
subrange for char or issuing an error.
* gm2-compiler/M2GenGCC.mod (ResolveConstantExpressions): Add
StringLengthOp, StringConvertM2nulOp, StringConvertCnulOp case
clauses.
(FindSize): Add assert IsConstStringKnown.
(StringToChar): New variable tokenno.
Add tokenno parameter to GetStringLength.
(FoldStringLength): New procedure.
(FoldStringConvertM2nul): New procedure.
(FoldStringConvertCnul): New procedure.
(CodeAddr): Add tokenno parameter.
Replace CurrentQuadToken with tokenno.
Add tokenno parameter to GetStringLength.
(PrepareCopyString): Rewrite.
(IsConstStrKnown): New procedure function.
(FoldAdd): Detect conststring op2 and op3 which are known and
concat.  Place result into op1.
(FoldStandardFunction): Pass tokenno as a parameter to
GetStringLength.
(CodeXIndr): Rewrite comment.
Rename op1 to left, op3 to right.
Pass rightpos to GetStringLength.
* gm2-compiler/M2Quads.def (QuadrupleOp): Add
StringConvertCnulOp, StringConvertM2nulOp and StringLengthOp.
* gm2-compiler/M2Quads.mod (import): Remove MakeConstLitString.
Add CopyConstString and PutConstStringKnown.
(IsInitialisingConst): Add StringConvertCnulOp,
StringConvertM2nulOp and StringLengthOp.
(callRequestDependant): Replace MakeConstLitString with
MakeConstString.
(DeferMakeConstStringCnul): New procedure function.
(DeferMakeConstStringM2nul): New procedure function.
(CheckParameter): Add early return if the string const is unknown.
(DescribeType): Add token parameter to GetStringLength.
Check for IsConstStringKnown.
(ManipulateParameters): Use DeferMakeConstStringCnul and
DeferMakeConstStringM2nul.
(MakeLengthConst): Remove and replace with...
(DeferMakeLengthConst): ... this.
(doBuildBinaryOp): Create ConstString and set it to contents
unknown.
Check IsConstStringKnown before generating error message.
(WriteQuad): Add StringConvertCnulOp, StringConvertM2nulOp and
StringLengthOp.
(WriteOperator): Add StringConvertCnulOp, StringConvertM2nulOp and
StringLengthOp.
* gm2-compiler/M2SymInit.mod (CheckReadBeforeInitQuad): Add
StringConvertCnulOp, StringConvertM2nulOp and StringLengthOp.
* gm2-compiler/NameKey.mod (LengthKey): Allow NulName to return 0.
* gm2-compiler/P2SymBuild.mod (BuildString): Replace
MakeConstLitString with MakeConstString.
(DetermineType): Replace PutConstString with PutConstStringKnown.
* gm2-compiler/SymbolTable.def (MakeConstVar): Tidy up comment.
(MakeConstLitString): Remove.
(MakeConstString): New procedure function.
(MakeConstStringCnul): New procedure function.
(MakeConstStringM2nul): New procedure function.
(PutConstStringKnown): New procedure.
(CopyConstString): New procedure.
(IsConstStringKnown): New procedure function.
(IsConstStringM2): New procedure function.
(IsConstStringC): New procedure function.
(IsConstStringM2nul): New procedure function.
(IsConstStringCnul): New procedure function.
(GetStringLength): Add token parameter.
(PutConstString): Remove.
(GetConstStringM2): Remove.
(GetConstStringC): Remove.
(GetConstStringM2nul): Remove.
(GetConstStringCnul): Remove.
(MakeConstStringC): Remove.
* gm2-compiler/SymbolTable.mod (SymConstString): Remove
M2Variant, NulM2Variant, CVariant, NulCVariant.
Add Known.
(CheckAnonymous): Replace $$ with __anon.
(IsNameAnonymous): Replace $$ with __anon.
(MakeConstVar): Detect whether the name is nul and treat as
a temporary constant.
(MakeConstLitString): Remove.
(BackFillString): Remove.
(InitConstString): Rewrite.
(GetConstStringM2): Remove.
(GetConstStringC): Remove.
(GetConstStringContent): New procedure function.
(GetConstStringM2nul): Remove.
(GetConstStringCnul): Remove.
(MakeConstStringCnul): Rewrite.
(MakeConstStringM2nul): Rewrite.
(MakeConstStringC): Remove.
(MakeConstString): Rewrite.
(PutConstStringKnown): New procedure.
(CopyConstString): New procedure.
(PutConstString): Remove.
(IsConstStringKnown): New procedure function.
(IsConstStringM2): New procedure function.
(IsConstStringC): Rewrite.
(IsConstStringM2nul): Rewrite.
(IsConstStringCnul): Rewrite.
(GetConstStringKind): New procedure function.
(GetString): Check Known.
(GetStringLength): Add token parameter and check Known.

gcc/testsuite/ChangeLog:

PR modula2/113889
* gm2/pim/run/pass/pim-run-pass.exp: Add filter for
constdef.mod.
* gm2/extensions/run/pass/callingc2.mod: New test.
* gm2/extensions/run/pass/callingc3.mod: New test.
* gm2/extensions/run/pass/callingc4.mod: New test.
* gm2/extensions/run/pass/callingc5.mod: New test.
* gm2/extensions/run/pass/callingc6.mod: New test.
* gm2/extensions/run/pass/callingc7.mod: New test.
* gm2/extensions/run/pass/callingc8.mod: New test.
* gm2/extensions/run/pass/fixedarray.mod: New test.
* gm2/extensions/run/pass/fixedarray2.mod: New test.
* gm2/pim/run/pass/constdef.def: New test.
* gm2/pim/run/pass/constdef.mod: New test.
* gm2/pim/run/pass/testimportconst.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
7 months agod: Add UTF BOM tests to gdc.dg testsuite
Iain Buclaw [Mon, 19 Feb 2024 10:33:16 +0000 (11:33 +0100)] 
d: Add UTF BOM tests to gdc.dg testsuite

Some of these are part of the upstream DMD `gdc.test' testsuite, but
they had been omitted because they get mangled by the lib/gdc-utils.exp
helpers when parsing and staging the tests. Translate them over to the
gdc.dg testsuite instead.

gcc/testsuite/ChangeLog:

* gdc.dg/bom_UTF16BE.d: New test.
* gdc.dg/bom_UTF16LE.d: New test.
* gdc.dg/bom_UTF32BE.d: New test.
* gdc.dg/bom_UTF32LE.d: New test.
* gdc.dg/bom_UTF8.d: New test.
* gdc.dg/bom_characters.d: New test.
* gdc.dg/bom_error_UTF8.d: New test.
* gdc.dg/bom_infer_UTF16BE.d: New test.
* gdc.dg/bom_infer_UTF16LE.d: New test.
* gdc.dg/bom_infer_UTF32BE.d: New test.
* gdc.dg/bom_infer_UTF32LE.d: New test.
* gdc.dg/bom_infer_UTF8.d: New test.

7 months agomatch.pd: Fix ICE on BIT_INSERT_EXPR of BIT_FIELD_REF folding [PR113967]
Jakub Jelinek [Mon, 19 Feb 2024 08:42:22 +0000 (09:42 +0100)] 
match.pd: Fix ICE on BIT_INSERT_EXPR of BIT_FIELD_REF folding [PR113967]

The following testcase ICEs, because BIT_FIELD_REF's position is not
multiple of the vector element's bit size and the code uses exact_div
to divide those 2 values.

For BIT_INSERT_EXPR, the tree-cfg.cc verification verifies the position
is a multiple of the inserted bit size when inserting into vectors,
but for BIT_FIELD_REF the position can be arbitrary if within the range.

The following patch fixes that.

2024-02-19  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/113967
* match.pd (bit_insert @0 (BIT_FIELD_REF @1 ..) ..): Require
in condition that @rpos is multiple of vector element size.

* gcc.dg/pr113967.c: New test.

7 months agoRISC-V: Suppress the vsetvl fusion for conflict successors
Juzhe-Zhong [Thu, 1 Feb 2024 09:02:52 +0000 (17:02 +0800)] 
RISC-V: Suppress the vsetvl fusion for conflict successors

Update in v2: Add dump information.

This patch fixes the following ineffective vsetvl insertion:

void f (int32_t * restrict in, int32_t * restrict out, size_t n, size_t cond, size_t cond2)
{
  for (size_t i = 0; i < n; i++)
    {
      if (i == cond) {
        vint8mf8_t v = *(vint8mf8_t*)(in + i + 100);
        *(vint8mf8_t*)(out + i + 100) = v;
      } else if (i == cond2) {
        vfloat32mf2_t v = *(vfloat32mf2_t*)(in + i + 200);
        *(vfloat32mf2_t*)(out + i + 200) = v;
      } else if (i == (cond2 - 1)) {
        vuint16mf2_t v = *(vuint16mf2_t*)(in + i + 300);
        *(vuint16mf2_t*)(out + i + 300) = v;
      } else {
        vint8mf4_t v = *(vint8mf4_t*)(in + i + 400);
        *(vint8mf4_t*)(out + i + 400) = v;
      }
    }
}

Before this patch:

f:
.LFB0:
        .cfi_startproc
        beq     a2,zero,.L12
        addi    a7,a0,400
        addi    a6,a1,400
        addi    a0,a0,1600
        addi    a1,a1,1600
        li      a5,0
        addi    t6,a4,-1
        vsetvli t3,zero,e8,mf8,ta,ma     ---> ineffective uplift
.L7:
        beq     a3,a5,.L15
        beq     a4,a5,.L16
        beq     t6,a5,.L17
        vsetvli t1,zero,e8,mf4,ta,ma
        vle8.v  v1,0(a0)
        vse8.v  v1,0(a1)
        vsetvli t3,zero,e8,mf8,ta,ma
.L4:
        addi    a5,a5,1
        addi    a7,a7,4
        addi    a6,a6,4
        addi    a0,a0,4
        addi    a1,a1,4
        bne     a2,a5,.L7
.L12:
        ret
.L15:
        vle8.v  v1,0(a7)
        vse8.v  v1,0(a6)
        j       .L4
.L17:
        vsetvli t1,zero,e8,mf4,ta,ma
        addi    t5,a0,-400
        addi    t4,a1,-400
        vle16.v v1,0(t5)
        vse16.v v1,0(t4)
        vsetvli t3,zero,e8,mf8,ta,ma
        j       .L4
.L16:
        addi    t5,a0,-800
        addi    t4,a1,-800
        vle32.v v1,0(t5)
        vse32.v v1,0(t4)
        j       .L4

It's obvious that we are hoisting the e8mf8 vsetvl to the top. It's ineffective since e8mf8 comes from
low probability block which is if (i == cond).

For this case, we disable such fusion.

After this patch:

f:
beq a2,zero,.L12
addi a7,a0,400
addi a6,a1,400
addi a0,a0,1600
addi a1,a1,1600
li a5,0
addi t6,a4,-1
.L7:
beq a3,a5,.L15
beq a4,a5,.L16
beq t6,a5,.L17
vsetvli t1,zero,e8,mf4,ta,ma
vle8.v v1,0(a0)
vse8.v v1,0(a1)
.L4:
addi a5,a5,1
addi a7,a7,4
addi a6,a6,4
addi a0,a0,4
addi a1,a1,4
bne a2,a5,.L7
.L12:
ret
.L15:
vsetvli t3,zero,e8,mf8,ta,ma
vle8.v v1,0(a7)
vse8.v v1,0(a6)
j .L4
.L17:
addi t5,a0,-400
addi t4,a1,-400
vsetvli t1,zero,e8,mf4,ta,ma
vle16.v v1,0(t5)
vse16.v v1,0(t4)
j .L4
.L16:
addi t5,a0,-800
addi t4,a1,-800
vsetvli t3,zero,e32,mf2,ta,ma
vle32.v v1,0(t5)
vse32.v v1,0(t4)
j .L4

Tested on both RV32/RV64 no regression. Ok for trunk ?

PR target/113696

gcc/ChangeLog:

* config/riscv/riscv-vsetvl.cc (pre_vsetvl::earliest_fuse_vsetvl_info):
Suppress vsetvl fusion.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/vsetvl/pr113696.c: New test.

7 months agoDaily bump.
GCC Administrator [Mon, 19 Feb 2024 00:17:46 +0000 (00:17 +0000)] 
Daily bump.

7 months agox86-64: Generate push2/pop2 only if the incoming stack is 16-byte aligned
H.J. Lu [Tue, 13 Feb 2024 21:32:44 +0000 (13:32 -0800)] 
x86-64: Generate push2/pop2 only if the incoming stack is 16-byte aligned

Since push2/pop2 requires 16-byte stack alignment, don't generate them
if the incoming stack isn't 16-byte aligned.

gcc/

PR target/113912
* config/i386/i386.cc (ix86_can_use_push2pop2): New.
(ix86_pro_and_epilogue_can_use_push2pop2): Use it.
(ix86_emit_save_regs): Don't generate push2 if
ix86_can_use_push2pop2 return false.
(ix86_expand_epilogue): Don't generate pop2 if
ix86_can_use_push2pop2 return false.

gcc/testsuite/

PR target/113912
* gcc.target/i386/apx-push2pop2-2.c: New test.

7 months agoAVR: Improve documentation for -mmcu=.
Georg-Johann Lay [Sun, 18 Feb 2024 11:45:31 +0000 (12:45 +0100)] 
AVR: Improve documentation for -mmcu=.

gcc/
* doc/invoke.texi (AVR Options) <-mmcu>: Remove "Atmel".
Note on complete device support.

7 months agoAVR: Add examples for ISR macro to interrupt attribute doc.
Georg-Johann Lay [Sun, 18 Feb 2024 10:59:06 +0000 (11:59 +0100)] 
AVR: Add examples for ISR macro to interrupt attribute doc.

gcc/
* doc/extend.texi (AVR Function Attributes): Fuse description
of "signal" and "interrupt" attribute.  Link pseudo instruction.

7 months agotestsuite: Mark non-optimized variants as expensive
Dimitar Dimitrov [Thu, 15 Feb 2024 19:02:37 +0000 (21:02 +0200)] 
testsuite: Mark non-optimized variants as expensive

When not optimized for speed, the test for PR112344 takes several
seconds to execute on native x86_64, and 15 minutes on PRU target
simulator.  Thus mark those variants as expensive.  The -O2 variant
which originally triggered the PR is not expensive, hence it is
still run by default.

PR middle-end/112344

gcc/testsuite/ChangeLog:

* gcc.dg/torture/pr112344.c: Run non-optimized variants only
if expensive tests are allowed.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
7 months agoLoongArch: Remove redundant symbol type conversions in larchintrin.h.
Lulu Cheng [Mon, 5 Feb 2024 08:53:01 +0000 (16:53 +0800)] 
LoongArch: Remove redundant symbol type conversions in larchintrin.h.

gcc/ChangeLog:

* config/loongarch/larchintrin.h (__movgr2fcsr): Remove redundant
symbol type conversions.
(__cacop_d): Likewise.
(__cpucfg): Likewise.
(__asrtle_d): Likewise.
(__asrtgt_d): Likewise.
(__lddir_d): Likewise.
(__ldpte_d): Likewise.
(__crc_w_b_w): Likewise.
(__crc_w_h_w): Likewise.
(__crc_w_w_w): Likewise.
(__crc_w_d_w): Likewise.
(__crcc_w_b_w): Likewise.
(__crcc_w_h_w): Likewise.
(__crcc_w_w_w): Likewise.
(__crcc_w_d_w): Likewise.
(__csrrd_w): Likewise.
(__csrwr_w): Likewise.
(__csrxchg_w): Likewise.
(__csrrd_d): Likewise.
(__csrwr_d): Likewise.
(__csrxchg_d): Likewise.
(__iocsrrd_b): Likewise.
(__iocsrrd_h): Likewise.
(__iocsrrd_w): Likewise.
(__iocsrrd_d): Likewise.
(__iocsrwr_b): Likewise.
(__iocsrwr_h): Likewise.
(__iocsrwr_w): Likewise.
(__iocsrwr_d): Likewise.
(__frecipe_s): Likewise.
(__frecipe_d): Likewise.
(__frsqrte_s): Likewise.
(__frsqrte_d): Likewise.

7 months agoLoongArch: Fix wrong return value type of __iocsrrd_h.
Lulu Cheng [Mon, 5 Feb 2024 08:23:20 +0000 (16:23 +0800)] 
LoongArch: Fix wrong return value type of __iocsrrd_h.

gcc/ChangeLog:

* config/loongarch/larchintrin.h (__iocsrrd_h): Modify the
function return value type to unsigned short.

7 months agoDaily bump.
GCC Administrator [Sun, 18 Feb 2024 00:17:05 +0000 (00:17 +0000)] 
Daily bump.

7 months agod: Merge dmd, druntime 9471b25db9, phobos 547886846.
Iain Buclaw [Sat, 17 Feb 2024 20:03:38 +0000 (21:03 +0100)] 
d: Merge dmd, druntime 9471b25db9, phobos 547886846.

D front-end changes:

- Import dmd v2.107.1-rc.1.

D runtime changes:

- Import druntime v2.107.1-rc.1.

Phobos changes:

- Import phobos v2.107.1-rc.1.

gcc/d/ChangeLog:

* dmd/MERGE: Merge upstream dmd 9471b25db9.
* dmd/VERSION: Bump version to v2.107.1-rc.1.
* Make-lang.in (D_FRONTEND_OBJS): Add d/cxxfrontend.o.
* d-attribs.cc (build_attributes): Update for new front-end interface.
* d-builtins.cc (build_frontend_type): Likewise.
(strip_type_modifiers): Likewise.
(covariant_with_builtin_type_p): Likewise.
* d-codegen.cc (declaration_type): Likewise.
(parameter_type): Likewise.
(build_array_struct_comparison): Likewise.
(void_okay_p): Likewise.
* d-convert.cc (convert_expr): Likewise.
(check_valist_conversion): Likewise.
* d-lang.cc (d_generate_ddoc_file): Likewise.
(d_parse_file): Likewise.
* d-target.cc (TargetCPP::toMangle): Likewise.
(TargetCPP::typeInfoMangle): Likewise.
(TargetCPP::thunkMangle): Likewise.
(TargetCPP::parameterType): Likewise.
* decl.cc (d_mangle_decl): Likewise.
(DeclVisitor::visit): Likewise.
(DeclVisitor::visit (CAsmDeclaration *)): New method.
(get_symbol_decl): Update for new front-end interface.
(layout_class_initializer): Likewise.
* expr.cc (ExprVisitor::visit): Likewise.
* intrinsics.cc (maybe_set_intrinsic): Likewise.
(expand_intrinsic_rotate): Likewise.
* modules.cc (layout_moduleinfo_fields): Likewise.
(layout_moduleinfo): Likewise.
* runtime.cc (get_libcall_type): Likewise.
* typeinfo.cc (make_frontend_typeinfo): Likewise.
(TypeInfoVisitor::visit): Likewise.
(create_typeinfo): Likewise.
* types.cc (same_type_p): Likewise.
(build_ctype): Likewise.

libphobos/ChangeLog:

* libdruntime/MERGE: Merge upstream druntime 9471b25db9.
* src/MERGE: Merge upstream phobos 547886846.

7 months agolibgfortran: [PR105473] Fix checks for decimal='comma'.
Jerry DeLisle [Sat, 17 Feb 2024 17:24:58 +0000 (09:24 -0800)] 
libgfortran: [PR105473] Fix checks for decimal='comma'.

PR libfortran/105473

libgfortran/ChangeLog:

* io/list_read.c (eat_separator): Reject comma as a
seprator when it is being used as a decimal point.
(parse_real): Reject a '.' when is should be a comma.
(read_real): Likewise.
* io/read.c (read_f): Add more checks for ',' and '.'
conditions.

gcc/testsuite/ChangeLog:

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

7 months agofortran: gfc_trans_subcomponent_assign fixes [PR113503]
Jakub Jelinek [Sat, 17 Feb 2024 15:54:08 +0000 (16:54 +0100)] 
fortran: gfc_trans_subcomponent_assign fixes [PR113503]

The r14-870 changes broke xtb package tests (reduced testcase is the first
one below) and caused ICEs on a test derived from that (the second one).
For the
  x = T(u = trim (us(1)))
statement, before that change gfortran used to emit weird code with
2 trim calls:
      _gfortran_string_trim (&len.2, (void * *) &pstr.1, 20, &us[0]);
      if (len.2 > 0)
        {
          __builtin_free ((void *) pstr.1);
        }
      D.4275 = len.2;
      t.0.u = (character(kind=1)[1:0] *) __builtin_malloc (MAX_EXPR <(sizetype) D.4275, 1>);
      t.0._u_length = D.4275;
      _gfortran_string_trim (&len.4, (void * *) &pstr.3, 20, &us[0]);
      (void) __builtin_memcpy ((void *) t.0.u, (void *) pstr.3, (unsigned long) NON_LVALUE_EXPR <len.4>);
      if (len.4 > 0)
        {
          __builtin_free ((void *) pstr.3);
        }
That worked at runtime, though it is wasteful.
That commit changed it to:
      slen.3 = len.2;
      t.0.u = (character(kind=1)[1:0] *) __builtin_malloc (MAX_EXPR <(sizetype) slen.3, 1>);
      t.0._u_length = slen.3;
      _gfortran_string_trim (&len.2, (void * *) &pstr.1, 20, &us[0]);
      (void) __builtin_memcpy ((void *) t.0.u, (void *) pstr.1, (unsigned long) NON_LVALUE_EXPR <len.2>);
      if (len.2 > 0)
        {
          __builtin_free ((void *) pstr.1);
        }
which results in -Wuninitialized warning later on and if one is unlucky and
the uninitialized len.2 variable is smaller than the trimmed length, it
results in heap overflow and often crashes later on.
The bug above is clear, len.2 is only initialized in the
_gfortran_string_trim (&len.2, (void * *) &pstr.1, 20, &us[0]);
call, but used before that.  Now, the
      slen.3 = len.2;
      t.0.u = (character(kind=1)[1:0] *) __builtin_malloc (MAX_EXPR <(sizetype) slen.3, 1>);
      t.0._u_length = slen.3;
statements come from the alloc_scalar_allocatable_subcomponent call,
while
      _gfortran_string_trim (&len.2, (void * *) &pstr.1, 20, &us[0]);
from the gfc_conv_expr (&se, expr); call which is done before the
alloc_scalar_allocatable_subcomponent call, but is only appended later on
with gfc_add_block_to_block (&block, &se.pre);
Now, obviously the alloc_scalar_allocatable_subcomponent emitted statements
can depend on the se.pre sequence statements which can compute variables
used by alloc_scalar_allocatable_subcomponent like the length.
On the other side, I think the se.pre sequence really shouldn't depend
on the changes done by alloc_scalar_allocatable_subcomponent, that is
initializing the FIELD_DECLs of the destination allocatable subcomponent
only, the gfc_conv_expr statements are already created, so all they could
in theory depend above is on t.0.u or t.0._u_length, but I believe if the
rhs dependened on the lhs content (which is allocated by those statements
but really uninitialized), it would need to be discovered by the dependency
analysis and forced into a temporary.
So, in order to fix the first testcase, the second hunk of the patch just
emits the se.pre block before the alloc_scalar_allocatable_subcomponent
changes rather than after it.

The second problem is an ICE on the second testcase.  expr in the caller
(expr2 inside of alloc_scalar_allocatable_subcomponent) has
expr2->ts.u.cl->backend_decl already set, INTEGER_CST 20, but
alloc_scalar_allocatable_subcomponent overwrites it to a new VAR_DECL
which it assigns a value to before the malloc.  That can work if the only
places the expr2->ts is ever used are in the same local block or its
subblocks (and only if it is dominated by the code emitted by
alloc_scalar_allocatable_subcomponent, so e.g. not if that call is inside
of a conditional code and use later unconditional), but doesn't work
if expr2->ts is used before that block or after it.  So, the exact ICE is
because of:
  slen.1 = 20;
    static character(kind=1) us[1][1:20] = {"foo                 "};
  x.u = 0B;
  x._u_length = 0;
  {
    struct t t.0;
    struct t D.4308;

    {
      integer(kind=8) slen.1;

      slen.1 = 20;
      t.0.u = (character(kind=1)[1:0] *) __builtin_malloc (MAX_EXPR <(sizetype) slen.1, 1>);
      t.0._u_length = slen.1;
      (void) __builtin_memcpy ((void *) t.0.u, (void *) &us[0], 20);
    }
where the first slen.1 = 20; is emitted because it sees us has a VAR_DECL
ts.u.cl->backend_decl and so it wants to initialize it to the actual length.
This is invalid GENERIC, because the slen.1 variable is only declared inside
of a {} later on and so uses outside of it are wrong.  Similarly wrong would
be if it is used later on.  E.g. in the same testcase if it has
  type(T) :: x, y
  x = T(u = us(1))
  y%u = us(1)
then there is
    {
      integer(kind=8) slen.1;

      slen.1 = 20;
      t.0.u = (character(kind=1)[1:0] *) __builtin_malloc (MAX_EXPR <(sizetype) slen.1, 1>);
      t.0._u_length = slen.1;
      (void) __builtin_memcpy ((void *) t.0.u, (void *) &us[0], 20);
    }
...
    if (y.u != 0B) goto L.1;
    y.u = (character(kind=1)[1:0] *) __builtin_malloc (MAX_EXPR <(sizetype) slen.1, 1>);
i.e. another use of slen.1, this time after slen.1 got out of scope.

I really don't understand why the code modifies
expr2->ts.u.cl->backend_decl, expr2 isn't used there anywhere except for
expr2->ts.u.cl->backend_decl expressions, so hacks like save the previous
value, overwrite it temporarily over some call that will use expr2 and
restore afterwards aren't needed - there are no such calls, so the
following patch fixes it just by not messing up with
expr2->ts.u.cl->backend_decl, only set it to size variable and overwrite
that with a temporary if needed.

2024-02-17  Jakub Jelinek  <jakub@redhat.com>

PR fortran/113503
* trans-expr.cc (alloc_scalar_allocatable_subcomponent): Don't
overwrite expr2->ts.u.cl->backend_decl, instead set size to
expr2->ts.u.cl->backend_decl first and use size instead of
expr2->ts.u.cl->backend_decl.
(gfc_trans_subcomponent_assign): Emit se.pre into block
before calling alloc_scalar_allocatable_subcomponent instead of
after it.

* gfortran.dg/pr113503_1.f90: New test.
* gfortran.dg/pr113503_2.f90: New test.

7 months agolibgfortran: Fix namelist read.
Jerry DeLisle [Sat, 17 Feb 2024 01:06:37 +0000 (17:06 -0800)] 
libgfortran: Fix namelist read.

PR libfortran/107068

libgfortran/ChangeLog:

* io/list_read.c (read_logical): When looking for a possible
variable name, check for left paren, indicating a possible
array reference.

gcc/testsuite/ChangeLog:

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

7 months agoc++: wrong looser excep spec for dep noexcept [PR113158]
Marek Polacek [Thu, 15 Feb 2024 22:07:43 +0000 (17:07 -0500)] 
c++: wrong looser excep spec for dep noexcept [PR113158]

Here we find ourselves in maybe_check_overriding_exception_spec in
a template context where we can't instantiate a dependent noexcept.
That's OK, but we have to defer the checking otherwise we give wrong
errors.

PR c++/113158

gcc/cp/ChangeLog:

* search.cc (maybe_check_overriding_exception_spec): Defer checking
when a noexcept couldn't be instantiated & evaluated to false/true.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/noexcept83.C: New test.

7 months agolibstdc++: [_GLIBCXX_DEBUG] Fix std::__niter_base behavior
François Dumont [Wed, 14 Feb 2024 05:59:12 +0000 (06:59 +0100)] 
libstdc++: [_GLIBCXX_DEBUG] Fix std::__niter_base behavior

std::__niter_base is used in _GLIBCXX_DEBUG mode to remove _Safe_iterator<>
wrapper on random access iterators. But doing so it should also preserve original
behavior to remove __normal_iterator wrapper.

libstdc++-v3/ChangeLog:

* include/bits/stl_algobase.h (std::__niter_base): Redefine the overload
definitions for __gnu_debug::_Safe_iterator.
* include/debug/safe_iterator.tcc (std::__niter_base): Adapt declarations.

7 months agoFortran: deferred length of character variables shall not get lost [PR113911]
Harald Anlauf [Fri, 16 Feb 2024 21:33:16 +0000 (22:33 +0100)] 
Fortran: deferred length of character variables shall not get lost [PR113911]

PR fortran/113911

gcc/fortran/ChangeLog:

* trans-array.cc (gfc_trans_deferred_array): Do not clobber
deferred length for a character variable passed as dummy argument.

gcc/testsuite/ChangeLog:

* gfortran.dg/allocatable_length_2.f90: New test.
* gfortran.dg/bind_c_optional-2.f90: Enable deferred-length test.

7 months agotestsuite: Fix up lra effective target
Jakub Jelinek [Sat, 17 Feb 2024 08:25:59 +0000 (09:25 +0100)] 
testsuite: Fix up lra effective target

Given the recent discussions on IRC started with Andrew P. mentioning that
an asm goto outputs test should have { target lra } and the lra effective
target in GCC 11/12 only returning 0 for PA and in 13/14 for PA/AVR, while
we clearly have 14 other targets which don't support LRA and a couple of
further ones which have an -mlra/-mno-lra switch (whatever default they
have), seems to me the effective target is quite broken.

The following patch rewrites it, such that it has a fast path for heavily
used targets which are for years known to use only LRA (just an
optimization) plus determines whether it is a LRA target or reload target
by scanning the -fdump-rtl-reload-details dump on an empty function,
LRA has quite a few always emitted messages in that case while reload has
none of those.

Tested on x86_64-linux and cross to s390x-linux, for the latter with both
make check-gcc RUNTESTFLAGS='--target_board=unix/-mno-lra dg.exp=pr107385.c'
where the test is now UNSUPPORTED and
make check-gcc RUNTESTFLAGS='--target_board=unix/-mlra dg.exp=pr107385.c'
where it fails because I don't have libc around.

There is one special case, NVPTX, which is a TARGET_NO_REGISTER_ALLOCATION
target.  I think claiming for it that it is a lra target is strange (even
though it effectively returns true for targetm.lra_p ()), unsure if it
supports asm goto with outputs or not, if it does and we want to test it,
perhaps we should introduce asm_goto_outputs effective target and use
lra || nvptx-*-* for that?

2024-02-17  Jakub Jelinek  <jakub@redhat.com>

* lib/target-supports.exp (check_effective_target_lra): Rewrite
to list some heavily used always LRA targets and otherwise check the
-fdump-rtl-reload-details dump for messages specific to LRA.

7 months agoDaily bump.
GCC Administrator [Sat, 17 Feb 2024 00:17:08 +0000 (00:17 +0000)] 
Daily bump.

7 months agolibgcc: fix Win32 CV abnormal spurious wakeups in timed wait [PR113850]
Matteo Italia [Fri, 9 Feb 2024 14:04:20 +0000 (15:04 +0100)] 
libgcc: fix Win32 CV abnormal spurious wakeups in timed wait [PR113850]

Fix a typo in __gthr_win32_abs_to_rel_time that caused it to return a
relative time in seconds instead of milliseconds. As a consequence,
__gthr_win32_cond_timedwait called SleepConditionVariableCS with a
1000x shorter timeout; this caused ~1000x more spurious wakeups in
CV timed waits such as std::condition_variable::wait_for or wait_until,
resulting generally in much higher CPU usage.

This can be demonstrated by this sample program:

```

int main() {
    std::condition_variable cv;
    std::mutex mx;
    bool pass = false;

    auto thread_fn = [&](bool timed) {
        int wakeups = 0;
        using sc = std::chrono::system_clock;
        auto before = sc::now();
        std::unique_lock<std::mutex> ml(mx);
        if (timed) {
            cv.wait_for(ml, std::chrono::seconds(2), [&]{
                ++wakeups;
                return pass;
            });
        } else {
            cv.wait(ml, [&]{
                ++wakeups;
                return pass;
            });
        }
        printf("pass: %d; wakeups: %d; elapsed: %d ms\n", pass, wakeups,
                int((sc::now() - before) / std::chrono::milliseconds(1)));
        pass = false;
    };

    {
        // timed wait, let expire
        std::thread t(thread_fn, true);
        t.join();
    }

    {
        // timed wait, wake up explicitly after 1 second
        std::thread t(thread_fn, true);
        std::this_thread::sleep_for(std::chrono::seconds(1));
        {
            std::unique_lock<std::mutex> ml(mx);
            pass = true;
        }
        cv.notify_all();
        t.join();
    }

    {
        // non-timed wait, wake up explicitly after 1 second
        std::thread t(thread_fn, false);
        std::this_thread::sleep_for(std::chrono::seconds(1));
        {
            std::unique_lock<std::mutex> ml(mx);
            pass = true;
        }
        cv.notify_all();
        t.join();
    }
    return 0;
}
```

On builds based on non-affected threading models (e.g. POSIX on Linux,
or winpthreads or MCF on Win32) the output is something like
```
pass: 0; wakeups: 2; elapsed: 2000 ms
pass: 1; wakeups: 2; elapsed: 991 ms
pass: 1; wakeups: 2; elapsed: 996 ms
```

while with the Win32 threading model we get
```
pass: 0; wakeups: 1418; elapsed: 2000 ms
pass: 1; wakeups: 479; elapsed: 988 ms
pass: 1; wakeups: 2; elapsed: 992 ms
```
(notice the huge number of wakeups in the timed wait cases only).

This commit fixes the conversion, adjusting the final division by
NSEC100_PER_SEC to use NSEC100_PER_MSEC instead (already defined in the
file and not used in any other place, so probably just a typo).

libgcc/ChangeLog:

PR libgcc/113850
* config/i386/gthr-win32-cond.c (__gthr_win32_abs_to_rel_time):
fix absolute timespec to relative milliseconds count
conversion (it incorrectly returned seconds instead of
milliseconds); this avoids spurious wakeups in
__gthr_win32_cond_timedwait

7 months agoAdd -Wstrict-aliasing to vector-struct-1.C testcase
Andrew Pinski [Fri, 16 Feb 2024 21:26:30 +0000 (13:26 -0800)] 
Add -Wstrict-aliasing to vector-struct-1.C testcase

As noticed by Marek Polacek in https://gcc.gnu.org/pipermail/gcc-patches/2024-February/645836.html,
this testcase was not failing before without -Wstrict-aliasing so let's add that option.

Committed as obvious after testing to make sure the test is now testing with `-Wstrict-aliasing` and `-flto`.

gcc/testsuite/ChangeLog:

* g++.dg/torture/vector-struct-1.C: Add -Wstrict-aliasing.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
7 months agoRegenerate .pot files
Joseph Myers [Fri, 16 Feb 2024 21:36:19 +0000 (21:36 +0000)] 
Regenerate .pot files

gcc/po/
* gcc.pot: Regenerate.

libcpp/po/
* cpplib.pot: Regenerate.

7 months agoc++: wrong looser exception spec with deleted fn
Marek Polacek [Thu, 15 Feb 2024 19:58:31 +0000 (14:58 -0500)] 
c++: wrong looser exception spec with deleted fn

I noticed we don't implement the "unless the overriding function is
defined as deleted" wording added to [except.spec] via CWG 1351.

DR 1351

gcc/cp/ChangeLog:

* search.cc (maybe_check_overriding_exception_spec): Don't error about
a looser exception specification if the overrider is deleted.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/noexcept82.C: New test.

7 months agolibstdc++: Fix FAIL: 26_numerics/random/pr60037-neg.cc again [PR113961]
Jonathan Wakely [Wed, 7 Feb 2024 11:31:10 +0000 (11:31 +0000)] 
libstdc++: Fix FAIL: 26_numerics/random/pr60037-neg.cc again [PR113961]

PR libstdc++/87744
PR libstdc++/113961

libstdc++-v3/ChangeLog:

* testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error
line number.

7 months agoc++: Add testcase for this PR [PR97990]
Andrew Pinski [Fri, 16 Feb 2024 18:55:43 +0000 (10:55 -0800)] 
c++: Add testcase for this PR [PR97990]

This testcase was fixed by r14-5934-gf26d68d5d128c8 but we should add
one to make sure it does not regress again.

Committed as obvious after a quick test on the testcase.

PR c++/97990

gcc/testsuite/ChangeLog:

* g++.dg/torture/vector-struct-1.C: New test.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
7 months agotestsuite: Add support for scanning assembly with comparitor
Edwin Lu [Mon, 12 Feb 2024 19:38:15 +0000 (11:38 -0800)] 
testsuite: Add support for scanning assembly with comparitor

There is currently no support for matching at least x lines of assembly
(only scan-assembler-times). This patch would allow setting upper or lower
bounds.

Use case: using different scheduler descriptions and/or cost models will change
assembler output. Testing common functionality across tunes would require a
separate testcase per tune since each assembly output would be different. If we
know a base number of lines should appear across all tunes (i.e. testing return
values: we expect at minimum n stores into register x), we can lower-bound the
test to search for scan-assembler-bound {RE for storing into register x} >= n.
This avoids artificially inflating the scan-assembler-times expected count due
to the assembler choosing to perform extra stores into register x (using it as
a temporary register).

The testcase would be more robust to cpu/tune changes at the cost of not being
as granular towards specific cpu tuning.

gcc/ChangeLog:

* doc/sourcebuild.texi: add scan-assembler-bound

gcc/testsuite/ChangeLog:

* lib/scanasm.exp: add scan-assembler-bound

Signed-off-by: Edwin Lu <ewlu@rivosinc.com>
7 months agoc++: add fixed testcase [PR111682]
Patrick Palka [Fri, 16 Feb 2024 17:44:27 +0000 (12:44 -0500)] 
c++: add fixed testcase [PR111682]

Fixed by the PR113612 fix r14-8960-g19ac327de421fe.

PR c++/111682

gcc/testsuite/ChangeLog:

* g++.dg/cpp1y/var-templ86.C: New test.

7 months agoc++: implicit move with throw [PR113853]
Marek Polacek [Wed, 14 Feb 2024 22:53:52 +0000 (17:53 -0500)] 
c++: implicit move with throw [PR113853]

Here we have

  template<class T>
  auto is_throwable(T t) -> decltype(throw t, true) { ... }

where we didn't properly mark 't' as IMPLICIT_RVALUE_P, which caused
the wrong overload to have been chosen.  Jason figured out it's because
we don't correctly implement [expr.prim.id.unqual]#4.2, which post-P2266
says that an id-expression is move-eligible if

"the id-expression (possibly parenthesized) is the operand of
a throw-expression, and names an implicitly movable entity that belongs
to a scope that does not contain the compound-statement of the innermost
lambda-expression, try-block, or function-try-block (if any) whose
compound-statement or ctor-initializer contains the throw-expression."

I worked out that it's trying to say that given

  struct X {
    X();
    X(const X&);
    X(X&&) = delete;
  };

the following should fail: the scope of the throw is an sk_try, and it's
also x's scope S, and S "does not contain the compound-statement of the
*try-block" so x is move-eligible, so we move, so we fail.

  void f ()
  try {
    X x;
    throw x;  // use of deleted function
  } catch (...) {
  }

Whereas here:

  void g (X x)
  try {
    throw x;
  } catch (...) {
  }

the throw is again in an sk_try, but x's scope is an sk_function_parms
which *does* contain the {} of the *try-block, so x is not move-eligible,
so we don't move, so we use X(const X&), and the code is fine.

The current code also doesn't seem to handle

  void h (X x) {
    void z (decltype(throw x, true));
  }

where there's no enclosing lambda or sk_try so we should move.

I'm not doing anything about lambdas because we shouldn't reach the
code at the end of the function: the DECL_HAS_VALUE_EXPR_P check
shouldn't let us go further.

PR c++/113789
PR c++/113853

gcc/cp/ChangeLog:

* typeck.cc (treat_lvalue_as_rvalue_p): Update code to better
reflect [expr.prim.id.unqual]#4.2.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/sfinae69.C: Remove dg-bogus.
* g++.dg/cpp0x/sfinae70.C: New test.
* g++.dg/cpp0x/sfinae71.C: New test.
* g++.dg/cpp0x/sfinae72.C: New test.
* g++.dg/cpp2a/implicit-move4.C: New test.

7 months agoc++: Diagnose this specifier on template parameters [PR113929]
Jakub Jelinek [Fri, 16 Feb 2024 16:42:32 +0000 (17:42 +0100)] 
c++: Diagnose this specifier on template parameters [PR113929]

For template parameters, the optional this specifier is in the grammar
template-parameter-list -> template-parameter -> parameter-declaration,
just [dcl.fct/6] says that it is only valid in parameter-list of certain
functions.  So, unlike the case of decl-specifier-seq used in non-terminals
other than parameter-declaration, I think it is better not to fix this
by
   cp_parser_decl_specifier_seq (parser,
-                                flags | CP_PARSER_FLAGS_PARAMETER,
+                                flags | (template_parameter_p ? 0
+                                         : CP_PARSER_FLAGS_PARAMETER),
                                 &decl_specifiers,
                                 &declares_class_or_enum);
which would be pretending it isn't in the grammar, but by diagnosing it
separately, which is what the following patch does.

2024-02-16  Jakub Jelinek  <jakub@redhat.com>

PR c++/113929
* parser.cc (cp_parser_parameter_declaration): Diagnose this specifier
on template parameter declaration.

* g++.dg/parse/pr113929.C: New test.

7 months agogdbhooks: regex syntax error
Jason Merrill [Mon, 5 Feb 2024 16:49:41 +0000 (11:49 -0500)] 
gdbhooks: regex syntax error

Recent python complains about this pattern with
  SyntaxWarning: invalid escape sequence '\s'
because \s in a regular string just means 's'; for it to mean whitespace,
you need \\ or for the pattern to be a raw string.

Curiously, break-on-pass completion works for me either with or without this
change, but at least this avoids the warning.

gcc/ChangeLog:

* gdbhooks.py: Fix regex syntax.

7 months agoc++/modules: stream TREE_UNAVAILABLE and LAMBDA_EXPR_REGEN_INFO
Patrick Palka [Fri, 16 Feb 2024 15:24:45 +0000 (10:24 -0500)] 
c++/modules: stream TREE_UNAVAILABLE and LAMBDA_EXPR_REGEN_INFO

gcc/cp/ChangeLog:

* module.cc (trees_out::core_bools): Stream TREE_UNAVAILABLE.
(trees_in::core_bools): Likewise.
(trees_out::core_vals): Stream LAMBDA_EXPR_REGEN_INFO.
(trees_in::core_vals): Likewise.

Reviewed-by: Jason Merrill <jason@redhat.com>
7 months agolibsanitizer: Intercept __makecontext_v2 on Solaris/SPARC [PR113785]
Rainer Orth [Fri, 16 Feb 2024 13:06:24 +0000 (14:06 +0100)] 
libsanitizer: Intercept __makecontext_v2 on Solaris/SPARC [PR113785]

c-c++-common/asan/swapcontext-test-1.c FAILs on Solaris/SPARC:

FAIL: c-c++-common/asan/swapcontext-test-1.c   -O0  execution test
FAIL: c-c++-common/asan/swapcontext-test-1.c   -O1  execution test
FAIL: c-c++-common/asan/swapcontext-test-1.c   -O2  execution test
FAIL: c-c++-common/asan/swapcontext-test-1.c   -O2 -flto  execution test
FAIL: c-c++-common/asan/swapcontext-test-1.c -O2 -flto -flto-partition=none
execution test
FAIL: c-c++-common/asan/swapcontext-test-1.c -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions execution test
FAIL: c-c++-common/asan/swapcontext-test-1.c   -O3 -g  execution test
FAIL: c-c++-common/asan/swapcontext-test-1.c   -Os  execution test

As detailed in PR sanitizer/113785, this happens because an ABI change
in Solaris 10/SPARC caused the external symbol for makecontext to be
changed to __makecontext_v2, which isn't intercepted.

The following patch, submitted upstream at
https://github.com/llvm/llvm-project/pull/81588, fixes that.

Tested on sparc-sun-solaris2.11 and i386-pc-solaris2.11.

2024-02-16  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

libsanitizer:
PR sanitizer/113785
* asan/asan_interceptors.cpp: Cherry-pick llvm-project revision
8c2033719a843a1880427a5e8caa5563248bce78.

7 months agotree-optimization/113895 - consistency check fails in copy_reference_ops_from_ref
Richard Biener [Fri, 16 Feb 2024 09:08:43 +0000 (10:08 +0100)] 
tree-optimization/113895 - consistency check fails in copy_reference_ops_from_ref

The following addresses consistency check fails in copy_reference_ops_from_ref
when we are handling out-of-bound array accesses (it's almost impossible
to identically mimic the get_ref_base_and_extent behavior).  It also
addresses the case where an out-of-bound constant offset computes to a
-1 off which is the special value for "unknown".  This patch basically
turns off verification in those cases.

PR tree-optimization/113895
* tree-ssa-sccvn.cc (copy_reference_ops_from_ref): Disable
consistency checking when there are out-of-bound array
accesses.  Allow -1 off when from an array reference with
constant index.

* gcc.dg/torture/pr113895-2.c: New testcase.
* gcc.dg/torture/pr113895-3.c: Likewise.
* gcc.dg/torture/pr113895-4.c: Likewise.

7 months agolibstdc++: Fix FAIL: 26_numerics/random/pr60037-neg.cc [PR113931]
Jonathan Wakely [Wed, 7 Feb 2024 11:31:10 +0000 (11:31 +0000)] 
libstdc++: Fix FAIL: 26_numerics/random/pr60037-neg.cc [PR113931]

PR libstdc++/87744
PR libstdc++/113931

libstdc++-v3/ChangeLog:

* testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error
line number.

7 months agolibstdc++: Improve docs for debug mode backtraces
Jonathan Wakely [Fri, 16 Feb 2024 10:43:19 +0000 (10:43 +0000)] 
libstdc++: Improve docs for debug mode backtraces

The configure option is no longer necessary.

libstdc++-v3/ChangeLog:

* doc/xml/manual/debug_mode.xml: Update docs for backtraces.
* doc/html/manual/debug_mode_using.html: Regenerate.

7 months agolibstdc++: Fix spelling of <envar> elements in manual
Jonathan Wakely [Fri, 16 Feb 2024 10:38:29 +0000 (10:38 +0000)] 
libstdc++: Fix spelling of <envar> elements in manual

libstdc++-v3/ChangeLog:

* doc/xml/manual/test.xml: Fix spelling of <envar> elements.
* doc/html/manual/test.html: Regenerate.

7 months agoRISC-V: Fix *sge<u>_<X:mode><GPR:mode> pattern
Kito Cheng [Fri, 16 Feb 2024 09:27:24 +0000 (17:27 +0800)] 
RISC-V: Fix *sge<u>_<X:mode><GPR:mode> pattern

*sge<u>_<X:mode><GPR:mode> pattern has referenced operand[2] which is
invalid...it should just use `slti<u>` rather than `slti%i2<u>`.

gcc/ChangeLog:

PR target/106543
* config/riscv/riscv.md (*sge<u>_<X:mode><GPR:mode>): Fix asm
pattern.

7 months agotestsuite: Require lto-plugin support in gcc.dg/lto/modref-3 etc. [PR98237]
Rainer Orth [Fri, 16 Feb 2024 08:47:35 +0000 (09:47 +0100)] 
testsuite: Require lto-plugin support in gcc.dg/lto/modref-3 etc. [PR98237]

gcc.dg/lto/modref-3 etc. FAIL on Solaris with the native linker:

FAIL: gcc-dg-lto-modref-3-01.exe scan-wpa-ipa-dump modref "parm 1 flags: no_direct_clobber no_direct_escape"
FAIL: gcc-dg-lto-modref-4-01.exe scan-wpa-ipa-dump modref "parm 1 flags: no_direct_clobber no_direct_escape"
FAIL: gcc.dg/lto/modref-3 c_lto_modref-3_0.o-c_lto_modref-3_1.o execute -O2 -flto-partition=max -fdump-ipa-modref -fno-ipa-sra -fno-ipa-cp -flto
FAIL: gcc.dg/lto/modref-4 c_lto_modref-4_0.o-c_lto_modref-4_1.o execute -O2 -flto-partition=max -fdump-ipa-modref -fno-ipa-sra -flto

The issue is that the tests require the linker plugin, which isn't
available with Solaris ld.  Thus, it also FAILs when gcc is configured
with --disable-lto-plugin.

This patch thus declares the requirement.  As it turns out, there's an
undocumented dg-require-linker-plugin already, but I introduce and use
the corresponding effective-target keyword and document both.

Given that the effective-target form is more flexible, I'm tempted to
remove dg-require-* with an empty arg as already mentioned in
sourcebuild.texi.  That is not this patch, however.

Tested on i386-pc-solaris2.11 with ld and gld.

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

gcc/testsuite:
PR ipa/98237
* lib/target-supports.exp (is-effective-target): Handle
linker_plugin.
* gcc.dg/lto/modref-3_0.c: Require linker_plugin support.
* gcc.dg/lto/modref-4_0.c: Likewise.

gcc:
* doc/sourcebuild.texi (Effective-Target Keywords, Other
attribugs): Document linker_plugin.
(Require Support): Document dg-require-linker-plugin.

7 months agoRISC-V: Add new option -march=help to print all supported extensions
Kito Cheng [Fri, 19 Jan 2024 02:29:10 +0000 (10:29 +0800)] 
RISC-V: Add new option -march=help to print all supported extensions

The output of -march=help is like below:

```
All available -march extensions for RISC-V:
        Name                Version
        i                       2.0, 2.1
        e                       2.0
        m                       2.0
        a                       2.0, 2.1
        f                       2.0, 2.2
        d                       2.0, 2.2
...
```

Also support -print-supported-extensions and --print-supported-extensions for
clang compatibility.

gcc/ChangeLog:

PR target/109349

* common/config/riscv/riscv-common.cc (riscv_arch_help): New.
* config/riscv/riscv-protos.h (RISCV_MAJOR_VERSION_BASE): New.
(RISCV_MINOR_VERSION_BASE): Ditto.
(RISCV_REVISION_VERSION_BASE): Ditto.
* config/riscv/riscv-c.cc (riscv_ext_version_value): Use enum
rather than magic number.
* config/riscv/riscv.h (riscv_arch_help): New.
(EXTRA_SPEC_FUNCTIONS): Add riscv_arch_help.
(DRIVER_SELF_SPECS): Handle -march=help, -print-supported-extensions and
--print-supported-extensions.
* config/riscv/riscv.opt (march=help): New.
(print-supported-extensions): New.
(-print-supported-extensions): New.
* doc/invoke.texi (RISC-V Options): Document -march=help.

Reviewed-by: Christoph Müllner <christoph.muellner@vrull.eu>
7 months agoArm: Fix incorrect tailcall-generation for indirect calls [PR113780]
Tejas Belagod [Thu, 25 Jan 2024 10:35:36 +0000 (16:05 +0530)] 
Arm: Fix incorrect tailcall-generation for indirect calls [PR113780]

This patch fixes a bug that causes indirect calls in PAC-enabled functions
to be tailcalled incorrectly when all argument registers R0-R3 are used.

2024-02-07  Tejas Belagod  <tejas.belagod@arm.com>

PR target/113780
* config/arm/arm.cc (arm_function_ok_for_sibcall): Don't allow tailcalls
for indirect calls with 4 or more arguments in pac-enabled functions.

* lib/target-supports.exp (v8_1m_main_pacbti): Add __ARM_FEATURE_PAUTH.
* gcc.target/arm/pac-sibcall.c: New.

7 months agoDaily bump.
GCC Administrator [Fri, 16 Feb 2024 00:17:22 +0000 (00:17 +0000)] 
Daily bump.

7 months agolibgomp: Update documentation for indirect calls in target regions
Kwok Cheung Yeung [Thu, 15 Feb 2024 21:22:26 +0000 (21:22 +0000)] 
libgomp: Update documentation for indirect calls in target regions

Support for indirect calls to procedures/functions in offloaded target
regions is now available for C, C++ and Fortran.

2024-02-15  Kwok Cheung Yeung  <kcyeung@baylibre.com>

libgomp/
* libgomp.texi (OpenMP 5.1): Mark indirect call support as fully
implemented.

7 months agoopenmp, fortran: Add Fortran support for indirect clause on the declare target directive
Kwok Cheung Yeung [Thu, 15 Feb 2024 20:59:39 +0000 (20:59 +0000)] 
openmp, fortran: Add Fortran support for indirect clause on the declare target directive

2024-02-15  Kwok Cheung Yeung  <kcyeung@baylibre.com>

gcc/fortran/
* dump-parse-tree.cc (show_attr): Handle omp_declare_target_indirect
attribute.
* f95-lang.cc (gfc_gnu_attributes): Add entry for 'omp declare
target indirect'.
* gfortran.h (symbol_attribute): Add omp_declare_target_indirect
field.
(struct gfc_omp_clauses): Add indirect field.
* openmp.cc (omp_mask2): Add OMP_CLAUSE_INDIRECT.
(gfc_match_omp_clauses): Match indirect clause.
(OMP_DECLARE_TARGET_CLAUSES): Add OMP_CLAUSE_INDIRECT.
(gfc_match_omp_declare_target): Check omp_device_type and apply
omp_declare_target_indirect attribute to symbol if indirect clause
active.  Show warning if there are only device_type and/or indirect
clauses on the directive.
* trans-decl.cc (add_attributes_to_decl): Add 'omp declare target
indirect' attribute if symbol has indirect attribute set.

gcc/testsuite/
* gfortran.dg/gomp/declare-target-4.f90 (f1): Update expected warning.
* gfortran.dg/gomp/declare-target-indirect-1.f90: New.
* gfortran.dg/gomp/declare-target-indirect-2.f90: New.

libgomp/
* testsuite/libgomp.fortran/declare-target-indirect-1.f90: New.
* testsuite/libgomp.fortran/declare-target-indirect-2.f90: New.
* testsuite/libgomp.fortran/declare-target-indirect-3.f90: New.

7 months agoanalyzer: remove offset_region size overloads [PR111266]
David Malcolm [Thu, 15 Feb 2024 21:01:36 +0000 (16:01 -0500)] 
analyzer: remove offset_region size overloads [PR111266]

PR analyzer/111266 reports a missing -Wanalyzer-out-of-bounds when
accessing relative to a concrete byte offset.

Root cause is that offset_region::get_{byte,bit}_size_sval were
attempting to compute the size that's valid to access, rather than the
size of the access attempt.

Fixed by removing these vfunc overrides from offset_region as the
base class implementation does the right thing.

gcc/analyzer/ChangeLog:
PR analyzer/111266
* region.cc (offset_region::get_byte_size_sval): Delete.
(offset_region::get_bit_size_sval): Delete.
* region.h (region::get_byte_size): Add comment clarifying that
this relates to the size of the access, rather than the size
that's valid to access.
(region::get_bit_size): Likewise.
(region::get_byte_size_sval): Likewise.
(region::get_bit_size_sval): Likewise.
(offset_region::get_byte_size_sval): Delete.
(offset_region::get_bit_size_sval): Delete.

gcc/testsuite/ChangeLog:
PR analyzer/111266
* c-c++-common/analyzer/out-of-bounds-pr111266.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
7 months agotestsuite: Require lra effective target for pr107385.c
Jakub Jelinek [Thu, 15 Feb 2024 19:04:01 +0000 (20:04 +0100)] 
testsuite: Require lra effective target for pr107385.c

Old reload doesn't support asm goto with output operands.
We have lra effective target (though, strangely it returns
0 just for 2 targets out of at least 16 targets with no LRA support),
so this patch uses it, similarly how it is done in other asm goto
tests with output operands.

2024-02-15  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/107385
* gcc.dg/pr107385.c: Require lra effective target.

7 months agoaarch64: Fix undefined code in vect_ctz_1.c
Andrew Pinski [Fri, 2 Feb 2024 21:13:58 +0000 (13:13 -0800)] 
aarch64: Fix undefined code in vect_ctz_1.c

The testcase gcc.target/aarch64/vect_ctz_1.c fails execution when running
with -march=armv9-a due to the testcase calls __builtin_ctz with a value of 0.
The testcase should not depend on undefined behavior of __builtin_ctz. So this
changes it to use the g form with the 2nd argument of 32. Now the execution part
of the testcase work. It still has a scan-assembler failure which should be fixed
seperately.

Tested on aarch64-linux-gnu.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/vect_ctz_1.c (TEST): Use g form of the builtin and pass 32
as the value expected at 0.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
7 months agotestsuite: Define _POSIX_SOURCE for tests [PR113278]
Torbjörn SVENSSON [Thu, 15 Feb 2024 16:46:24 +0000 (17:46 +0100)] 
testsuite: Define _POSIX_SOURCE for tests [PR113278]

As the tests assume that fileno() is visible (only part of POSIX),
define the guard to ensure that it's visible.  Currently, glibc appears
to always have this defined in C++, newlib does not.

Without this patch, fails like this can be seen:

Testing analyzer/fileno-1.c,  -std=c++98
.../fileno-1.c: In function 'int test_pass_through(FILE*)':
.../fileno-1.c:5:10: error: 'fileno' was not declared in this scope
FAIL: c-c++-common/analyzer/fileno-1.c  -std=c++98 (test for excess errors)

Patch has been verified on Linux.

gcc/testsuite/ChangeLog:
PR testsuite/113278
* c-c++-common/analyzer/fileno-1.c: Define _POSIX_SOURCE.
* c-c++-common/analyzer/flex-with-call-summaries.c: Same.
* c-c++-common/analyzer/flex-without-call-summaries.c: Same.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>