]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
18 months agolibstdc++: Avoid reusing moved-from iterators in PSTL tests [PR90276]
Jonathan Wakely [Wed, 31 Jan 2024 10:41:49 +0000 (10:41 +0000)] 
libstdc++: Avoid reusing moved-from iterators in PSTL tests [PR90276]

The reverse_invoker utility for PSTL tests uses forwarding references for
all parameters, but some of those parameters get forwarded to move
constructors which then leave the objects in a moved-from state. When
the parameters are forwarded a second time that results in making new
copies of moved-from iterators.  For libstdc++ debug mode iterators, the
moved-from state is singular, which means copying them will abort at
runtime.

The fix is to make copies of iterator arguments instead of forwarding
them.

The callers of reverse_invoker::operator() also forward the iterators
multiple times, but that's OK because reverse_invoker accepts them by
forwarding reference but then breaks the chain of forwarding and copies
them as lvalues.

libstdc++-v3/ChangeLog:

PR libstdc++/90276
* testsuite/util/pstl/test_utils.h (reverse_invoker): Do not use
perfect forwarding for iterator arguments.

(cherry picked from commit 723a7c1ad29523b9ddff53c7b147bffea56fbb63)

18 months agolibstdc++: Remove noexcept from std::osyncstream::operator=
Jonathan Wakely [Thu, 1 Feb 2024 21:23:27 +0000 (21:23 +0000)] 
libstdc++: Remove noexcept from std::osyncstream::operator=

This should not be noexcept because its _M_syncbuf member has a
potentially-throwing move assignment operator. The noexcept was removed
by LWG 3867.

libstdc++-v3/ChangeLog:

* include/std/syncstream (basic_osyncstream::operator=): Remove
noexcept, as per LWG 3867.

(cherry picked from commit 67f5a8c802463228da7c7bb2ab100095217560a6)

18 months agolibstdc++: Allow explicit conversion of string views with different traits
Jonathan Wakely [Thu, 1 Feb 2024 21:40:33 +0000 (21:40 +0000)] 
libstdc++: Allow explicit conversion of string views with different traits

This was changed by LWG 3857.

libstdc++-v3/ChangeLog:

* include/std/string_view (basic_string_view(R&&)): Remove
constraint that traits_type must be the same, as per LWG 3857.
* testsuite/21_strings/basic_string_view/cons/char/range_c++20.cc:
Explicit conversion between different specializations should be
allowed.
* testsuite/21_strings/basic_string_view/cons/wchar_t/range_c++20.cc:
Likewise.

(cherry picked from commit f60d7e1c64518936797ec1009cb49f72f8fe45b9)

18 months agoAVR: target/113824 - Fix multilib set for ATA5795.
Georg-Johann Lay [Thu, 8 Feb 2024 10:48:59 +0000 (11:48 +0100)] 
AVR: target/113824 - Fix multilib set for ATA5795.

gcc/
PR target/113824
* config/avr/avr-mcus.def (ata5797): Move from avr5 to avr4.
* doc/avr-mmcu.texi: Rebuild.

(cherry picked from commit 969bc5805eecb04a278e751e861805cfa04a4d5f)

18 months agoAVR: Always define __AVR_PM_BASE_ADDRESS__ in specs provided the core has it.
Georg-Johann Lay [Thu, 8 Feb 2024 10:39:53 +0000 (11:39 +0100)] 
AVR: Always define __AVR_PM_BASE_ADDRESS__ in specs provided the core has it.

gcc/
* config/avr/gen-avr-mmcu-specs.cc (print_mcu) <*cpp_mcu>: Spec always
defines __AVR_PM_BASE_ADDRESS__ if the core has it.

(cherry picked from commit e515d813f080fb4c4e70d3c7b01815a909893688)

18 months agoDaily bump.
GCC Administrator [Thu, 8 Feb 2024 00:21:50 +0000 (00:21 +0000)] 
Daily bump.

18 months agoUpdate gcc zh_CN.po
Joseph Myers [Wed, 7 Feb 2024 21:24:24 +0000 (21:24 +0000)] 
Update gcc zh_CN.po

* zh_CN.po: Update.

18 months agoFix contracts-tmpl-spec2.C on targets where plain char is unsigned by default
Andrew Pinski [Fri, 24 Nov 2023 02:55:30 +0000 (18:55 -0800)] 
Fix contracts-tmpl-spec2.C on targets where plain char is unsigned by default

Since contracts-tmpl-spec2.C is just testing contracts, I thought it would be better
to just add `-fsigned-char` to the options rather than change the testcase to support
both cases.

Committed after testing on aarch64-linux-gnu.

gcc/testsuite/ChangeLog:

PR testsuite/108321
* g++.dg/contracts/contracts-tmpl-spec2.C: Add -fsigned-char
to options.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
(cherry picked from commit 6e15e4e1abed02443a27a69455f4bfa49457c99e)

18 months agotestsuite: Replace many dg-require-thread-fence with dg-require-atomic-cmpxchg-word
Hans-Peter Nilsson [Wed, 4 Oct 2023 02:16:18 +0000 (04:16 +0200)] 
testsuite: Replace many dg-require-thread-fence with dg-require-atomic-cmpxchg-word

These tests actually use a form of atomic compare and exchange
operation, not just atomic loading and storing.  Some targets (not
supported by e.g. libatomic) have atomic loading and storing, but not
compare and exchange, yielding linker errors for missing library
functions.

This change is just for existing uses of
dg-require-thread-fence.  It does not fix any other tests
that should also be gated on dg-require-atomic-cmpxchg-word.

* testsuite/29_atomics/atomic/compare_exchange_padding.cc,
testsuite/29_atomics/atomic_flag/clear/1.cc,
testsuite/29_atomics/atomic_flag/cons/value_init.cc,
testsuite/29_atomics/atomic_flag/test_and_set/explicit.cc,
testsuite/29_atomics/atomic_flag/test_and_set/implicit.cc,
testsuite/29_atomics/atomic_ref/compare_exchange_padding.cc,
testsuite/29_atomics/atomic_ref/generic.cc,
testsuite/29_atomics/atomic_ref/integral.cc,
testsuite/29_atomics/atomic_ref/pointer.cc: Replace
dg-require-thread-fence with dg-require-atomic-cmpxchg-word.

(cherry picked from commit ba0cde8ba2d93b7193050eb5ef3cc6f7a2cdfe61)

18 months agotestsuite: Add dg-require-atomic-cmpxchg-word
Hans-Peter Nilsson [Wed, 4 Oct 2023 01:40:25 +0000 (03:40 +0200)] 
testsuite: Add dg-require-atomic-cmpxchg-word

Some targets (armv6-m) support inline atomic load and store,
i.e. dg-require-thread-fence matches, but not atomic operations like
compare and exchange.

This directive can be used to replace uses of dg-require-thread-fence
where an atomic operation is actually used.

* testsuite/lib/dg-options.exp (dg-require-atomic-cmpxchg-word):
New proc.
* testsuite/lib/libstdc++.exp (check_v3_target_atomic_cmpxchg_word):
Ditto.

(cherry picked from commit 2a4d9e4f533c77870cc0eb60fbbd8047da4c7386)

18 months agolibstdc++: Add dg-require-thread-fence in several tests
Christophe Lyon [Thu, 14 Sep 2023 08:59:20 +0000 (08:59 +0000)] 
libstdc++: Add dg-require-thread-fence in several tests

Some targets like arm-eabi with newlib and default settings rely on
__sync_synchronize() to ensure synchronization.  Newlib does not
implement it by default, to make users aware they have to take special
care.

This makes a few tests fail to link.

This patch requires the missing thread-fence effective target in the
tests that need it, making them UNSUPPORTED instead of FAIL and
UNRESOLVED.

2023-09-10  Christophe Lyon  <christophe.lyon@linaro.org>

libstdc++-v3/
* testsuite/29_atomics/atomic/compare_exchange_padding.cc: Likewise.
* testsuite/29_atomics/atomic/cons/value_init.cc: Likewise.
* testsuite/29_atomics/atomic_float/value_init.cc: Likewise.
* testsuite/29_atomics/atomic_integral/cons/value_init.cc: Likewise.
* testsuite/29_atomics/atomic_ref/compare_exchange_padding.cc: Likewise.
* testsuite/29_atomics/atomic_ref/generic.cc: Likewise.
* testsuite/29_atomics/atomic_ref/integral.cc: Likewise.
* testsuite/29_atomics/atomic_ref/pointer.cc: Likewise.

(cherry picked from commit 62b29347c38394ae32858f2301aa9aa65205984e)

18 months agoaarch64: Avoid out-of-range shrink-wrapped saves [PR111677]
Alex Coplan [Tue, 30 Jan 2024 09:39:59 +0000 (09:39 +0000)] 
aarch64: Avoid out-of-range shrink-wrapped saves [PR111677]

The PR shows us ICEing due to an unrecognizable TFmode save emitted by
aarch64_process_components.  The problem is that for T{I,F,D}mode we
conservatively require mems to be in range for x-register ldp/stp.  That
is because (at least for TImode) it can be allocated to both GPRs and
FPRs, and in the GPR case that is an x-reg ldp/stp, and the FPR case is
a q-register load/store.

As Richard pointed out in the PR, aarch64_get_separate_components
already checks that the offsets are suitable for a single load, so we
just need to choose a mode in aarch64_reg_save_mode that gives the full
q-register range.  In this patch, we choose V16QImode as an alternative
16-byte "bag-of-bits" mode that doesn't have the artificial range
restrictions imposed on T{I,F,D}mode.

Unlike for GCC 14 we need additional handling in the load/store pair
code as various cases are not expecting to see V16QImode (particularly
the writeback patterns, but also aarch64_gen_load_pair).

This is a backport of
r14-8657-g0529ba8168c89f24314e8750237d77bb132bea9c.

gcc/ChangeLog:

PR target/111677
* config/aarch64/aarch64.cc (aarch64_reg_save_mode): Use
V16QImode for the full 16-byte FPR saves in the vector PCS case.
(aarch64_gen_storewb_pair): Handle V16QImode.
(aarch64_gen_loadwb_pair): Likewise.
(aarch64_gen_load_pair): Likewise.
* config/aarch64/aarch64.md (loadwb_pair<TX:mode>_<P:mode>):
Rename to ...
(loadwb_pair<TX_V16QI:mode>_<P:mode>): ... this, extending to
V16QImode.
(storewb_pair<TX:mode>_<P:mode>): Rename to ...
(storewb_pair<TX_V16QI:mode>_<P:mode>): ... this, extending to
V16QImode.
* config/aarch64/iterators.md (TX_V16QI): New.

gcc/testsuite/ChangeLog:

PR target/111677
* gcc.target/aarch64/torture/pr111677.c: New test.

18 months agoDaily bump.
GCC Administrator [Wed, 7 Feb 2024 00:21:23 +0000 (00:21 +0000)] 
Daily bump.

18 months agotree-optimization/112618 - unused .MASK_CALL
Richard Biener [Mon, 20 Nov 2023 10:12:43 +0000 (11:12 +0100)] 
tree-optimization/112618 - unused .MASK_CALL

We have to make sure to remove unused .MASK_CALL internal function
calls after vectorization.

PR tree-optimization/112618
* tree-vect-loop.cc (vect_transform_loop_stmt): For not
relevant and unused .MASK_CALL make sure we remove the
scalar stmt.

* gcc.dg/pr112618.c: New testcase.

(cherry picked from commit 57c028acbec4f7b594e6b024e02d6c799b51e03d)

18 months agotree-optimization/112505 - bit-precision induction vectorization
Richard Biener [Thu, 11 Jan 2024 13:00:33 +0000 (14:00 +0100)] 
tree-optimization/112505 - bit-precision induction vectorization

Vectorization of bit-precision inductions isn't implemented but we
don't check this, instead we ICE during transform.

PR tree-optimization/112505
* tree-vect-loop.cc (vectorizable_induction): Reject
bit-precision induction.

* gcc.dg/vect/pr112505.c: New testcase.

(cherry picked from commit ec345df53556ec581590347f71c3d9ff3cdbca76)

18 months agotree-optimization/112495 - alias versioning and address spaces
Richard Biener [Mon, 13 Nov 2023 09:20:37 +0000 (10:20 +0100)] 
tree-optimization/112495 - alias versioning and address spaces

We are not correctly handling differing address spaces in dependence
analysis runtime alias check generation so refuse to do that.

PR tree-optimization/112495
* tree-data-ref.cc (runtime_alias_check_p): Reject checks
between different address spaces.

* gcc.target/i386/pr112495.c: New testcase.

(cherry picked from commit 0f593c0521caab8cfac53514b1a5e7d0d0dd1932)

18 months agotree-optimization/110221 - SLP and loop mask/len
Richard Biener [Fri, 10 Nov 2023 11:39:11 +0000 (12:39 +0100)] 
tree-optimization/110221 - SLP and loop mask/len

The following fixes the issue that when SLP stmts are internal defs
but appear invariant because they end up only using invariant defs
then they get scheduled outside of the loop.  This nice optimization
breaks down when loop masks or lens are applied since those are not
explicitly tracked as dependences.  The following makes sure to never
schedule internal defs outside of the vectorized loop when the
loop uses masks/lens.

PR tree-optimization/110221
* tree-vect-slp.cc (vect_schedule_slp_node): When loop
masking / len is applied make sure to not schedule
intenal defs outside of the loop.

* gfortran.dg/pr110221.f: New testcase.

(cherry picked from commit e5f1956498251a4973d52c8aad3faf34d0443169)

18 months agomiddle-end/110176 - wrong zext (bool) <= (int) 4294967295u folding
Richard Biener [Wed, 31 Jan 2024 13:40:24 +0000 (14:40 +0100)] 
middle-end/110176 - wrong zext (bool) <= (int) 4294967295u folding

The following fixes a wrong pattern that didn't match the behavior
of the original fold_widened_comparison in that get_unwidened
returned a constant always in the wider type.  But here we're
using (int) 4294967295u without the conversion applied.  Fixed
by doing as earlier in the pattern - matching constants only
if the conversion was actually applied.

PR middle-end/110176
* match.pd (zext (bool) <= (int) 4294967295u): Make sure
to match INTEGER_CST only without outstanding conversion.

* gcc.dg/torture/pr110176.c: New testcase.

(cherry picked from commit 22dbfbe8767ff4c1d93e39f68ec7c2d5b1358beb)

18 months agolibstdc++: /dev/null is not accessible on Windows
Torbjörn SVENSSON [Mon, 5 Feb 2024 19:06:03 +0000 (20:06 +0100)] 
libstdc++: /dev/null is not accessible on Windows

When running the DejaGNU testsuite on a toolchain built for native
Windows, the path /dev/null can't be used to open a stream to void.
On native Windows, the resource is instead named "nul".

In 17_intro/tag_type_explicit_ctor.cc, the following statement would
fail to match when the DejaGNU testsuite is running in cygwin with a
native toolchain.
// dg-error 53 "explicit" "" { target hosted }

The "target hosted"-check is using cpp to verify if _GLIBCXX_HOSTED is
defined and discards the output by simply redirecting it to /dev/null.
In v3_target_compile, it's overridden to "nul" for MinGW targets, but
the same rule applies when host is cygwin, so replace the condition
with a check for Windows.

The error in the log would look like this for the "target hosted" check:
cc1plus.exe: fatal error: opening output file /dev/null: No such file or directory

The tag_type_explicit_ctor.cc test fails with this on Windows:
.../tag_type_explicit_ctor.cc:53: error: converting to 'std::defer_lock_t' from initializer list would use explicit constructor 'constexpr std::defer_lock_t::defer_lock_t()'
.../tag_type_explicit_ctor.cc:54: error: converting to 'std::try_to_lock_t' from initializer list would use explicit constructor 'constexpr std::try_to_lock_t::try_to_lock_t()'
.../tag_type_explicit_ctor.cc:55: error: converting to 'std::try_to_lock_t' from initializer list would use explicit constructor 'constexpr std::try_to_lock_t::try_to_lock_t()'
.../tag_type_explicit_ctor.cc:67: error: converting to 'std::defer_lock_t' from initializer list would use explicit constructor 'constexpr std::defer_lock_t::defer_lock_t()'
.../tag_type_explicit_ctor.cc:68: error: converting to 'std::try_to_lock_t' from initializer list would use explicit constructor 'constexpr std::try_to_lock_t::try_to_lock_t()'
.../tag_type_explicit_ctor.cc:69: error: converting to 'std::adopt_lock_t' from initializer list would use explicit constructor 'constexpr std::adopt_lock_t::adopt_lock_t()'

Patch has been verified on Windows and Linux.

libstdc++-v3:

* testsuite/lib/libstdc++.exp: Use "nul" for Windows, "/dev/null"
for other environments.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
(cherry picked from commit 1e4664b97daf85d3134baa47a5af3db23658df34)

18 months agoc++: defaulted op== for incomplete class [PR107291]
Jason Merrill [Tue, 6 Feb 2024 00:56:45 +0000 (19:56 -0500)] 
c++: defaulted op== for incomplete class [PR107291]

After complaining about lack of friendship, we should not try to go on and
define the defaulted comparison operator anyway.

PR c++/107291

gcc/cp/ChangeLog:

* method.cc (early_check_defaulted_comparison): Fail if not friend.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/spaceship-eq17.C: New test.

(cherry picked from commit c5d34912ad576be1ef19be92f7eabde54b9089eb)

18 months agoDaily bump.
GCC Administrator [Tue, 6 Feb 2024 00:22:08 +0000 (00:22 +0000)] 
Daily bump.

18 months agoc++: prvalue of array type [PR111286]
Jason Merrill [Mon, 5 Feb 2024 18:54:22 +0000 (13:54 -0500)] 
c++: prvalue of array type [PR111286]

Here we want to build a prvalue array to bind to the T reference, but we
were wrongly trying to strip cv-quals from the array prvalue, which should
be treated the same as a class prvalue.

PR c++/111286

gcc/cp/ChangeLog:

* tree.cc (rvalue): Don't drop cv-quals from an array.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/initlist-array22.C: New test.

(cherry picked from commit c7e8381748f78335e9fef23f363b6a9e4463ce7e)

18 months agovarasm: check float size [PR109359]
Jason Merrill [Thu, 1 Jun 2023 18:41:07 +0000 (14:41 -0400)] 
varasm: check float size [PR109359]

In PR95226, the testcase was failing because we tried to output_constant a
NOP_EXPR to float from a double REAL_CST, and so we output a double where
the caller wanted a float.  That doesn't happen anymore, but with the
output_constant hunk we will ICE in that situation rather than emit the
wrong number of bytes.

Part of the problem was that initializer_constant_valid_p_1 returned true
for that NOP_EXPR, because it compared the sizes of integer types but not
floating-point types.  So the C++ front end assumed it didn't need to fold
the initializer.

This also fixed the test for PR109359.

PR c++/95226
PR c++/109359

gcc/ChangeLog:

* varasm.cc (output_constant) [REAL_TYPE]: Check that sizes match.
(initializer_constant_valid_p_1): Compare float precision.

gcc/testsuite/ChangeLog:

* g++.dg/ext/frounding-math1.C: New test.

(cherry picked from commit e7cc4d703bceb9095316c106eba0d1939c6c8044)

18 months agoUpdate gcc zh_CN.po
Joseph Myers [Mon, 5 Feb 2024 21:35:02 +0000 (21:35 +0000)] 
Update gcc zh_CN.po

* zh_CN.po: Update.

18 months agomips: Fix missing mode in neg<mode:MSA>2
Xi Ruoyao [Mon, 5 Feb 2024 12:17:25 +0000 (20:17 +0800)] 
mips: Fix missing mode in neg<mode:MSA>2

I was too sleepy writting this :(.

gcc/ChangeLog:

* config/mips/mips-msa.md (neg<mode:MSA>2): Add missing mode for
neg.

(cherry picked from commit 55357960fbddd261e32f088f5dd328d58b0f25b3)

18 months agoMIPS: Fix wrong MSA FP vector negation
Xi Ruoyao [Fri, 2 Feb 2024 19:35:07 +0000 (03:35 +0800)] 
MIPS: Fix wrong MSA FP vector negation

We expanded (neg x) to (minus const0 x) for MSA FP vectors, this is
wrong because -0.0 is not 0 - 0.0.  This causes some Python tests to
fail when Python is built with MSA enabled.

Use the bnegi.df instructions to simply reverse the sign bit instead.

gcc/ChangeLog:

* config/mips/mips-msa.md (elmsgnbit): New define_mode_attr.
(neg<mode>2): Change the mode iterator from MSA to IMSA because
in FP arithmetic we cannot use (0 - x) for -x.
(neg<mode>2): New define_insn to implement FP vector negation,
using a bnegi instruction to negate the sign bit.

(cherry picked from commit 4d7fe3cf82505b45719356a2e51b1480b5ee21d6)

18 months agoDaily bump.
GCC Administrator [Mon, 5 Feb 2024 00:21:40 +0000 (00:21 +0000)] 
Daily bump.

18 months agoDaily bump.
GCC Administrator [Sun, 4 Feb 2024 00:21:34 +0000 (00:21 +0000)] 
Daily bump.

18 months agoRevert use of accumulator type in expansion of 'Reduce attribute
Eric Botcazou [Sat, 3 Feb 2024 12:26:03 +0000 (13:26 +0100)] 
Revert use of accumulator type in expansion of 'Reduce attribute

gcc/ada
* exp_attr.adb (Expand_N_Attribute_Reference): Revert older change.

18 months agoRevert fix for reduction expression with overloaded reducer subprogram
Eric Botcazou [Sat, 3 Feb 2024 11:59:16 +0000 (12:59 +0100)] 
Revert fix for reduction expression with overloaded reducer subprogram

gcc/ada
* exp_attr.adb (Expand_N_Attribute_Reference): Revert latest change.

18 months agoDaily bump.
GCC Administrator [Sat, 3 Feb 2024 00:21:40 +0000 (00:21 +0000)] 
Daily bump.

18 months agoc++: op== defaulted outside class [PR110084]
Jason Merrill [Fri, 2 Feb 2024 17:04:11 +0000 (12:04 -0500)] 
c++: op== defaulted outside class [PR110084]

defaulted_late_check is for checks that need to happen after the class is
complete; we shouldn't call it sooner.

PR c++/110084

gcc/cp/ChangeLog:

* pt.cc (tsubst_function_decl): Only check a function defaulted
outside the class if the class is complete.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/spaceship-synth-neg3.C: Check error message.
* g++.dg/cpp2a/spaceship-eq16.C: New test.

(cherry picked from commit e17a122d417fc0d606bcb3a3705b93ee81745cab)

18 months agoc++: variable template array of unknown bound [PR113638]
Jason Merrill [Thu, 1 Feb 2024 21:54:39 +0000 (16:54 -0500)] 
c++: variable template array of unknown bound [PR113638]

When we added variable templates, we didn't extend the VAR_HAD_UNKNOWN_BOUND
handling for class template static data members to handle them as well.

PR c++/113638

gcc/cp/ChangeLog:

* cp-tree.h: Adjust comment.
* pt.cc (instantiate_template): Set VAR_HAD_UNKNOWN_BOUND for
variable template.

gcc/testsuite/ChangeLog:

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

(cherry picked from commit 0b786ff38ab398087820d91241e030a28c451df9)

18 months agoc++: no_unique_address and constexpr [PR112439]
Jason Merrill [Thu, 1 Feb 2024 22:23:53 +0000 (17:23 -0500)] 
c++: no_unique_address and constexpr [PR112439]

Here, because we don't build a CONSTRUCTOR for an empty base, we were
wrongly marking the Foo CONSTRUCTOR as complete after initializing the Empty
member.  Fixed by checking empty_base here as well.

PR c++/112439

gcc/cp/ChangeLog:

* constexpr.cc (cxx_eval_store_expression): Check empty_base
before marking a CONSTRUCTOR readonly.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/no_unique_address15.C: New test.

(cherry picked from commit f4998609908e4926fc095ce97cb84b187294fd1d)

18 months agoDaily bump.
GCC Administrator [Fri, 2 Feb 2024 00:21:36 +0000 (00:21 +0000)] 
Daily bump.

18 months agohppa: Fix bug in atomic_storedi_1 pattern
John David Anglin [Thu, 1 Feb 2024 18:46:47 +0000 (18:46 +0000)] 
hppa: Fix bug in atomic_storedi_1 pattern

The first alternative stores the floating-point status register
in the destination.  It should store zero.  We need to copy %fr0
to another floating-point register to initialize it to zero.

2024-02-01  John David Anglin  <danglin@gcc.gnu.org>

gcc/ChangeLog:

* config/pa/pa.md (atomic_storedi_1): Fix bug in
alternative 1.

18 months agoc++: ICE with throw inside concept [PR112437]
Marek Polacek [Wed, 31 Jan 2024 22:33:26 +0000 (17:33 -0500)] 
c++: ICE with throw inside concept [PR112437]

We crash in the loop at the end of treat_lvalue_as_rvalue_p for code
like

  template <class T>
  concept Throwable = requires(T x) { throw x; };

because the code assumes that we eventually reach sk_function_parms or
sk_try and bail, but in a concept we're in a sk_namespace.

We're already checking sk_try so we don't crash in a function-try-block,
but I've added a test anyway.

PR c++/112437

gcc/cp/ChangeLog:

* typeck.cc (treat_lvalue_as_rvalue_p): Bail out on sk_namespace in
the move on throw of parms loop.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-throw1.C: New test.
* g++.dg/eh/throw4.C: New test.

(cherry picked from commit 65b105b4f399559685200e1598ead8c7d0935c04)

18 months agoDaily bump.
GCC Administrator [Thu, 1 Feb 2024 00:23:18 +0000 (00:23 +0000)] 
Daily bump.

18 months agoFortran: fix bounds-checking errors for CLASS array dummies [PR104908]
Harald Anlauf [Sat, 27 Jan 2024 16:41:43 +0000 (17:41 +0100)] 
Fortran: fix bounds-checking errors for CLASS array dummies [PR104908]

Commit r11-1235 addressed issues with bounds of unlimited polymorphic array
dummies.  However, using the descriptor from sym->backend_decl does break
the case of CLASS array dummies.  The obvious solution is to restrict the
fix to the unlimited polymorphic case, thus keeping the original descriptor
in the ordinary case.

gcc/fortran/ChangeLog:

PR fortran/104908
* trans-array.cc (gfc_conv_array_ref): Restrict use of transformed
descriptor (sym->backend_decl) to the unlimited polymorphic case.

gcc/testsuite/ChangeLog:

PR fortran/104908
* gfortran.dg/pr104908.f90: New test.

(cherry picked from commit ce61de1b8a1bb3a22118e900376f380768f2ba59)

18 months agoAVR: Add AVR64DU and some older devices.
Georg-Johann Lay [Wed, 31 Jan 2024 08:33:37 +0000 (09:33 +0100)] 
AVR: Add AVR64DU and some older devices.

gcc/
* config/avr/avr-mcus.def: Add AVR64DU28, AVR64DU32, ATA5787,
ATA5835, ATtiny64AUTO, ATA5700M322.
* doc/avr-mmcu.texi: Rebuild.

(cherry picked from commit e7964bf623c6df3cb415eeafd458b0b8394e6ea4)

18 months agoDaily bump.
GCC Administrator [Wed, 31 Jan 2024 00:24:03 +0000 (00:24 +0000)] 
Daily bump.

18 months agolibstdc++: Fix std::format for floating-point chrono::time_point [PR113500]
Jonathan Wakely [Sun, 21 Jan 2024 18:16:14 +0000 (18:16 +0000)] 
libstdc++: Fix std::format for floating-point chrono::time_point [PR113500]

Currently trying to use std::format with certain specializations of
std::chrono::time_point is ill-formed, due to one member function of the
__formatter_chrono type which tries to write a time_point to an ostream.
For sys_time<floating-point> or sys_time with a period greater than days
there is no operator<< that can be used.

That operator<< is only needed when using an empty chrono-specs in the
format string, like "{}", but the ill-formed expression gives an error
even if not actually used. This means it's not possible to format some
other specializations of chrono::time_point, even when using a non-empty
chrono-specs.

This fixes it by avoiding using 'os << t' for all chrono::time_point
specializations, and instead using std::format("{:L%F %T}", t). So that
we continue to reject std::format("{}", sys_time{1.0s}) a check for
empty chrono-specs is added to the formatter<sys_time<D>, C>
specialization.

While testing this I noticed that the output for %S with a
floating-point duration was incorrect, as the subseconds part was being
appended to the seconds without a decimal point, and without the correct
number of leading zeros.

libstdc++-v3/ChangeLog:

PR libstdc++/113500
* include/bits/chrono_io.h (__formatter_chrono::_M_S): Fix
printing of subseconds with floating-point rep.
(__formatter_chrono::_M_format_to_ostream): Do not write
time_point specializations directly to the ostream.
(formatter<chrono::sys_time<D>, C>::parse): Do not allow an
empty chrono-spec if the type fails to meet the constraints for
writing to an ostream with operator<<.
* testsuite/std/time/clock/file/io.cc: Check formatting
non-integral times with empty chrono-specs.
* testsuite/std/time/clock/gps/io.cc: Likewise.
* testsuite/std/time/clock/utc/io.cc: Likewise.
* testsuite/std/time/hh_mm_ss/io.cc: Likewise.

(cherry picked from commit 7431fcea6b72beb54abb1932c254ac0e76bd0bde)

18 months agolibstdc++: Fix std::chrono::file_clock conversions for low-precision times
Jonathan Wakely [Sun, 21 Jan 2024 18:11:16 +0000 (18:11 +0000)] 
libstdc++: Fix std::chrono::file_clock conversions for low-precision times

The std::chrono::file_clock conversions were not using common_type and
so failed to compile when converting anything that should have increased
precision after arithmetic with a std::chrono::seconds value.

libstdc++-v3/ChangeLog:

* include/bits/chrono.h (__file_clock::from_sys)
(__file_clock::to_sys, __file_clock::_S_from_sys)
(__file_clock::_S_to_sys): Use common_type for return type.
* testsuite/std/time/clock/file/members.cc: Check round trip
conversion for time with lower precision that seconds.

(cherry picked from commit fba15da8fa518bfb8d3e061795bc3ca2dea01d27)

18 months agolibstdc++: Fix std::format floating-point alternate forms [PR113512]
Jonathan Wakely [Sat, 20 Jan 2024 00:44:12 +0000 (00:44 +0000)] 
libstdc++: Fix std::format floating-point alternate forms [PR113512]

The logic for handling '#' forms was ... not good. The count of
significant figures just counted digits, instead of ignoring leading
zeros. And when moving the result from the stack buffer to a dynamic
string the exponent could get lost in some cases.

libstdc++-v3/ChangeLog:

PR libstdc++/113512
* include/std/format (__formatter_fp::format): Fix logic for
alternate forms.
* testsuite/std/format/functions/format.cc: Check buggy cases of
alternate forms with g presentation type.

(cherry picked from commit a57439d61937925cec48df6166b2a805ae7054d5)

18 months agoDaily bump.
GCC Administrator [Tue, 30 Jan 2024 00:24:37 +0000 (00:24 +0000)] 
Daily bump.

18 months agoDaily bump.
GCC Administrator [Mon, 29 Jan 2024 00:23:13 +0000 (00:23 +0000)] 
Daily bump.

18 months agoDaily bump.
GCC Administrator [Sun, 28 Jan 2024 00:21:56 +0000 (00:21 +0000)] 
Daily bump.

18 months agoc-family: Fix ICE with large column number after restoring a PCH [PR105608]
Lewis Hyatt [Tue, 5 Dec 2023 16:33:39 +0000 (11:33 -0500)] 
c-family: Fix ICE with large column number after restoring a PCH [PR105608]

Users are allowed to define macros prior to restoring a precompiled header
file, as long as those macros are not defined (or are defined identically)
in the PCH.  However, the PCH restoration process destroys all the macro
definitions, so libcpp has to record them before restoring the PCH and then
redefine them afterward.

This process does not currently assign great locations to the macros after
redefining them. Some work is needed to also remember the original locations
and get the line_maps instance in the right state (since, like all other
data structures, the line_maps instance is also reset after restoring a PCH).
The new testcase line-map-3.C contains XFAILed examples where the locations
are wrong.

This patch addresses a more pressing issue, which is that we ICE in some
cases since GCC 11, hitting an assert in line-maps.cc. It happens if the
first line encountered after the PCH restore requires an LC_RENAME map, such
as will happen if the line is sufficiently long.  This is much easier to
fix, since we just need to call linemap_line_start before asking libcpp to
redefine the stored macros, instead of afterward, to avoid the unexpected
need for an LC_RENAME before an LC_ENTER has been seen.

gcc/c-family/ChangeLog:

PR preprocessor/105608
* c-pch.cc (c_common_read_pch): Start a new line map before asking
libcpp to restore macros defined prior to reading the PCH, instead
of afterward.

gcc/testsuite/ChangeLog:

PR preprocessor/105608
* g++.dg/pch/line-map-1.C: New test.
* g++.dg/pch/line-map-1.Hs: New test.
* g++.dg/pch/line-map-2.C: New test.
* g++.dg/pch/line-map-2.Hs: New test.
* g++.dg/pch/line-map-3.C: New test.
* g++.dg/pch/line-map-3.Hs: New test.

18 months agoDaily bump.
GCC Administrator [Sat, 27 Jan 2024 00:22:21 +0000 (00:22 +0000)] 
Daily bump.

18 months agoc++: ambiguous member lookup for rewritten cands [PR113529]
Patrick Palka [Wed, 24 Jan 2024 22:11:09 +0000 (17:11 -0500)] 
c++: ambiguous member lookup for rewritten cands [PR113529]

Here we handle the operator expression u < v inconsistently: in a SFINAE
context we accept it, and in a non-SFINAE context we reject it with

  error: request for member 'operator<=>' is ambiguous

as per [class.member.lookup]/6.  This inconsistency is ultimately
because we neglect to propagate error_mark_node after recursing in
add_operator_candidates, fixed like so.

PR c++/113529

gcc/cp/ChangeLog:

* call.cc (add_operator_candidates): Propagate error_mark_node
result after recursing to find rewritten candidates.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/spaceship-sfinae3.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit fecb45a936d62ca24dd8b4985ea0555c28edefa8)

18 months agoAArch64: Add -mcpu=cobalt-100
Wilco Dijkstra [Thu, 25 Jan 2024 16:01:58 +0000 (16:01 +0000)] 
AArch64: Add -mcpu=cobalt-100

Add support for -mcpu=cobalt-100 (Neoverse N2 with a different implementer ID).

gcc/ChangeLog:
* config/aarch64/aarch64-cores.def (AARCH64_CORE): Add 'cobalt-100' CPU.
* config/aarch64/aarch64-tune.md: Regenerated.
* doc/invoke.texi (-mcpu): Add cobalt-100 core.

(cherry picked from commit a0d16e1c06e04c11d1eef9705036bad8ac1a11d4)

18 months agoDaily bump.
GCC Administrator [Fri, 26 Jan 2024 00:23:14 +0000 (00:23 +0000)] 
Daily bump.

18 months agoAVR: target/113601 - Fix wrong data start for ATmega3208 and ATmega3209.
Georg-Johann Lay [Thu, 25 Jan 2024 17:51:04 +0000 (18:51 +0100)] 
AVR: target/113601 - Fix wrong data start for ATmega3208 and ATmega3209.

gcc/
PR target/113601
* config/avr/avr-mcus.def (atmega3208, atmega3209): Fix data_section_start.

(cherry picked from commit 6b678d8f96ad5ffb8de9e3f1f1694cb21d7a2c33)

18 months agoAVR: Add AVR16EB, AVR16EA and AVR32EA devices.
Georg-Johann Lay [Tue, 16 Jan 2024 10:38:06 +0000 (11:38 +0100)] 
AVR: Add AVR16EB, AVR16EA and AVR32EA devices.

gcc/
* config/avr/avr-mcus.def (avr16eb14, avr16eb20, avr16eb28, avr16eb32)
(avr16ea28, avr16ea32, avr16ea48, avr32ea28, avr32ea32, avr32ea48): Add.
* doc/avr-mmcu.texi: Regenerate.

(cherry picked from commit 9aaafcb342da56a2bbbc2e9db0dceac3faa5de3b)

18 months agoDaily bump.
GCC Administrator [Thu, 25 Jan 2024 00:23:53 +0000 (00:23 +0000)] 
Daily bump.

18 months agoc++: throwing cleanup after return [PR113347]
Jason Merrill [Tue, 23 Jan 2024 20:41:09 +0000 (15:41 -0500)] 
c++: throwing cleanup after return [PR113347]

Here we were assuming that current_retval_sentinel would be set if we have
seen a throwing cleanup, but that's not the case if the cleanup is after all
returns.

This change isn't needed on trunk, where current_retval_sentinel is set for
all NRV functions.

PR c++/113347

gcc/cp/ChangeLog:

* semantics.cc (finalize_nrv_r): Handle null
current_retval_sentinel.

gcc/testsuite/ChangeLog:

* g++.dg/eh/return3.C: New test.

18 months agoc++: xvalue array subscript [PR103185]
Jason Merrill [Tue, 19 Dec 2023 21:12:02 +0000 (16:12 -0500)] 
c++: xvalue array subscript [PR103185]

Normally we handle xvalue array subscripting with ARRAY_REF, but in this
case we weren't doing that because the operands were reversed.  Handle that
case better.

PR c++/103185

gcc/cp/ChangeLog:

* typeck.cc (cp_build_array_ref): Handle swapped operands.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1z/array-prvalue2.C: New test.
* g++.dg/cpp1z/eval-order3.C: Test swapped operands.

(cherry picked from commit 8dfc52a75d4d6c8be1c61b4aa831b1812b14a10e)

18 months agoc++: throwing dtor and empty try [PR113088]
Jason Merrill [Wed, 20 Dec 2023 16:06:27 +0000 (11:06 -0500)] 
c++: throwing dtor and empty try [PR113088]

maybe_splice_retval_cleanup assumed that the function body can't be empty if
there's a throwing cleanup, but when I added cleanups to try blocks in
r12-6333-gb10e031458d541 I didn't adjust that assumption.

PR c++/113088
PR c++/33799

gcc/cp/ChangeLog:

* except.cc (maybe_splice_retval_cleanup): Handle an empty block.

gcc/testsuite/ChangeLog:

* g++.dg/eh/return2.C: New test.

(cherry picked from commit 02c0b49798228d777610f898cd9d63ebec43656d)

18 months agosra: Disqualify bases of operands of asm gotos
Martin Jambor [Wed, 24 Jan 2024 19:35:00 +0000 (20:35 +0100)] 
sra: Disqualify bases of operands of asm gotos

PR 110422 shows that SRA can ICE assuming there is a single edge
outgoing from a block terminated with an asm goto.  We need that for
BB-terminating statements so that any adjustments they make to the
aggregates can be copied over to their replacements.  Because we can't
have that after ASM gotos, we need to punt.

gcc/ChangeLog:

2024-01-17  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/110422
* tree-sra.cc (scan_function): Disqualify bases of operands of asm
gotos.

gcc/testsuite/ChangeLog:

2024-01-17  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/110422
* gcc.dg/torture/pr110422.c: New test.

(cherry picked from commit 6764043e88a4208f7c69bf0ccd19ddc7a6016fb1)

18 months agoDaily bump.
GCC Administrator [Wed, 24 Jan 2024 00:22:53 +0000 (00:22 +0000)] 
Daily bump.

18 months agoDaily bump.
GCC Administrator [Tue, 23 Jan 2024 00:23:22 +0000 (00:23 +0000)] 
Daily bump.

18 months agoDaily bump.
GCC Administrator [Mon, 22 Jan 2024 00:22:03 +0000 (00:22 +0000)] 
Daily bump.

18 months agoDaily bump.
GCC Administrator [Sun, 21 Jan 2024 00:22:05 +0000 (00:22 +0000)] 
Daily bump.

18 months agoDaily bump.
GCC Administrator [Sat, 20 Jan 2024 00:22:38 +0000 (00:22 +0000)] 
Daily bump.

18 months agoDaily bump.
GCC Administrator [Fri, 19 Jan 2024 00:21:36 +0000 (00:21 +0000)] 
Daily bump.

18 months agoFortran: intrinsic ISHFTC and missing optional argument SIZE [PR67277]
Harald Anlauf [Sat, 13 Jan 2024 21:00:21 +0000 (22:00 +0100)] 
Fortran: intrinsic ISHFTC and missing optional argument SIZE [PR67277]

gcc/fortran/ChangeLog:

PR fortran/67277
* trans-intrinsic.cc (gfc_conv_intrinsic_ishftc): Handle optional
dummy argument for SIZE passed to ISHFTC.  Set default value to
BIT_SIZE(I) when missing.

gcc/testsuite/ChangeLog:

PR fortran/67277
* gfortran.dg/ishftc_optional_size_1.f90: New test.

(cherry picked from commit 20da56165273c8814b3c53e6d71549ba6a37e0cd)

18 months agolibstdc++: Fix std::format test for Solaris [PR113450]
Jonathan Wakely [Wed, 17 Jan 2024 21:40:25 +0000 (21:40 +0000)] 
libstdc++: Fix std::format test for Solaris [PR113450]

When int8_t is a typedef for char (rather than signed char) this test
fails because it tries to format a char, which is treated differently
from formatting other integral types (including signed char).

Use signed char explicitly so the result doesn't depend on the
non-portable definition of int8_t.

libstdc++-v3/ChangeLog:

PR libstdc++/113450
* testsuite/std/format/functions/format.cc: Use signed char
instead of int8_t.

(cherry picked from commit db42a0a98916340af33338c08e6a7d328121b958)

18 months agolibstdc++: Use variable template to fix -fconcepts-ts error [PR113366]
Jonathan Wakely [Sat, 13 Jan 2024 12:13:33 +0000 (12:13 +0000)] 
libstdc++: Use variable template to fix -fconcepts-ts error [PR113366]

There's an error for -fconcepts-ts due to using a concept where a bool
NTTP is required, which is fixed by using the vraiable template that
already exists in the class scope.

This doesn't fix the problem with -fconcepts-ts as changes to the
placement of attributes is also needed.

libstdc++-v3/ChangeLog:

PR testsuite/113366
* include/std/format (basic_format_arg): Use __formattable
variable template instead of __format::__formattable_with
concept.

(cherry picked from commit 6c703b4eb68cbc32de1d62e5b573cb1b9857af29)

18 months agolibstdc++: Update tzdata to 2023d
Jonathan Wakely [Fri, 12 Jan 2024 16:57:41 +0000 (16:57 +0000)] 
libstdc++: Update tzdata to 2023d

Import the new 2023d tzdata.zi file. The leapseconds file was also
updated to have a new expiry (no new leap seconds were added).

libstdc++-v3/ChangeLog:

* src/c++20/tzdata.zi: Import new file from 2023d release.
* src/c++20/tzdb.cc (tzdb_list::_Node::_S_read_leap_seconds)
Update expiry date for leap seconds list.

(cherry picked from commit 4f141b051ef4476da2cd39c622b2eae73c696d88)

18 months agoc++: address of class NTTP object as targ [PR113242]
Patrick Palka [Wed, 17 Jan 2024 18:01:01 +0000 (13:01 -0500)] 
c++: address of class NTTP object as targ [PR113242]

invalid_tparm_referent_p was rejecting using the address of a class NTTP
object as a template argument, but this should be fine.

PR c++/113242
PR c++/99493

gcc/cp/ChangeLog:

* pt.cc (invalid_tparm_referent_p) <case ADDR_EXPR>: Suppress
DECL_ARTIFICIAL rejection test for class NTTP objects.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/nontype-class61.C: New test.
* g++.dg/cpp2a/nontype-class62.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit 68cea2d32a9fd525154b6a48042e5835d4c5e371)

18 months agoDaily bump.
GCC Administrator [Thu, 18 Jan 2024 00:22:01 +0000 (00:22 +0000)] 
Daily bump.

18 months agoDaily bump.
GCC Administrator [Wed, 17 Jan 2024 00:26:38 +0000 (00:26 +0000)] 
Daily bump.

18 months agosparc: Char arrays are 64-bit aligned on SPARC
Daniel Cederman [Fri, 8 Dec 2023 08:49:12 +0000 (09:49 +0100)] 
sparc: Char arrays are 64-bit aligned on SPARC

pr88077 fails on SPARC since char HeaderStr[1] in pr88077_1.c and
long HeaderStr in pr88077_0.c differs in alignment.

Warning printed by Binutils ld:
warning: alignment 4 of normal symbol `HeaderStr' in c_lto_pr88077_0.o is
smaller than 8 used by the common definition in c_lto_pr88077_1.o

gcc/testsuite/ChangeLog:

* gcc.dg/lto/pr88077_0.c: Change type to match alignment for SPARC

18 months agotestsuite: Skip ifcvt-4.c for SPARC V8
Daniel Cederman [Mon, 8 Jan 2024 08:08:43 +0000 (09:08 +0100)] 
testsuite: Skip ifcvt-4.c for SPARC V8

Conditional moves are not available in SPARC V8.

gcc/testsuite/ChangeLog:

* gcc.dg/ifcvt-4.c: Skip for SPARC V8

18 months agosparc: Treat instructions with length 0 as empty
Daniel Cederman [Tue, 5 Dec 2023 14:26:27 +0000 (15:26 +0100)] 
sparc: Treat instructions with length 0 as empty

This is to handle the membar_empty instruction that can be generated
when compiling for UT699.

gcc/ChangeLog:

* config/sparc/sparc.cc (next_active_non_empty_insn): Length 0 treated as empty

18 months agosparc: Add errata workaround to membar patterns
Daniel Cederman [Thu, 4 Jan 2024 13:56:06 +0000 (14:56 +0100)] 
sparc: Add errata workaround to membar patterns

LEON now uses the standard V8 membar patterns that contains an ldstub
instruction. This instruction needs to be aligned properly when the
GR712RC errata workaround is enabled.

gcc/ChangeLog:

* config/sparc/sparc.cc (atomic_insn_for_leon3_p): Treat membar_storeload as atomic
* config/sparc/sync.md (membar_storeload): Turn into named insn
and add GR712RC errata workaround.
(membar_v8): Add GR712RC errata workaround.

18 months agosparc: Revert membar optimization that is not suitable for LEON5
Andreas Larsson [Mon, 16 Jan 2023 14:43:24 +0000 (15:43 +0100)] 
sparc: Revert membar optimization that is not suitable for LEON5

LEON5 has a deeper write-buffer and hence stb is not enough to flush a
write out. For compatibility, use the default V8 approach for both
LEON3 and LEON5.

This reverts commit 49cc765db35a5a21cab2aece27a44983fa70b94b,
"sync.md (*membar_storeload_leon3): New insn."

gcc/ChangeLog:

* config/sparc/sync.md (*membar_storeload_leon3): Remove
(*membar_storeload): Enable for LEON

18 months agoAVR: target/107201: Make -nodevicelib work for all devices.
Georg-Johann Lay [Mon, 15 Jan 2024 12:25:59 +0000 (13:25 +0100)] 
AVR: target/107201: Make -nodevicelib work for all devices.

driver-avr.cc contains a spec that discriminates between cores
and devices by means of a mmcu=avr* spec pattern.  This does not
work for new devices like AVR128* which also start with mmcu=avr
like all cores do.  The patch uses a new spec function in order to
tell apart cores from devices.

gcc/
PR target/107201
* config/avr/avr.h (EXTRA_SPEC_FUNCTIONS): Add no-devlib, avr_no_devlib.
* config/avr/driver-avr.cc (avr_no_devlib): New function.
(avr_devicespecs_file): Use it to remove -nodevicelib from the
options for cores only.
* config/avr/avr-arch.h (avr_get_parch): New prototype.
* config/avr/avr-devices.cc (avr_get_parch): New function.

(cherry picked from commit 86fac7ee1688bdec245a43f6d2ab49fb238892e4)

18 months agoDaily bump.
GCC Administrator [Tue, 16 Jan 2024 00:26:24 +0000 (00:26 +0000)] 
Daily bump.

18 months agoc++: explicit inst w/ similar constrained partial specs [PR104634]
Patrick Palka [Mon, 15 Jan 2024 21:53:28 +0000 (16:53 -0500)] 
c++: explicit inst w/ similar constrained partial specs [PR104634]

Here we neglect to emit the definitions of A<double>::f2 and A<double*>::f4
despite the explicit instantiations ultimately because TREE_PUBLIC isn't
set on the corresponding partial specializations, whose declarations are
created from maybe_new_partial_specialization which is responsible for
disambiguating them from the first and third partial specializations (which
have the same class-head but different constraints).  This makes grokfndecl
in turn clear TREE_PUBLIC for f2 and f4 as if they have internal linkage.

This patch fixes this by setting TREE_PUBLIC appropriately for such partial
specializations.

PR c++/104634

gcc/cp/ChangeLog:

* pt.cc (maybe_new_partial_specialization): Propagate TREE_PUBLIC
to the newly created partial specialization.

gcc/testsuite/ChangeLog:

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

Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit 47673571b28278d857371167f4b67a04a1b87b59)

18 months agoc++: non-dep array list-init w/ non-triv dtor [PR109899]
Patrick Palka [Mon, 15 Jan 2024 21:49:19 +0000 (16:49 -0500)] 
c++: non-dep array list-init w/ non-triv dtor [PR109899]

The get_target_expr call added in r12-7069-g119cea98f66476 causes us
for the below testcase to call build_vec_delete in a template context,
which builds a templated destructor call and checks expr_noexcept_p for
it, which ICEs because the call has templated form.

Much of the work of build_vec_delete however is code generation and thus
will just get discarded in a template context, and that includes the
code guarded by expr_noexcept_p.  So this patch narrowly fixes this ICE
by eliding the expr_noexcept_p call when in a template context.

PR c++/109899

gcc/cp/ChangeLog:

* init.cc (build_vec_delete_1): Assume expr_noexcept_p returns
false in a template context.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/initlist-array21.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit d33c3b5ac9b9b3e314ae9118d483ade7e91a80a5)

18 months agoAVR: target/113156 - Fix ICE due to missing "Save" on -m[long-]double= options.
Andrew Pinski [Mon, 15 Jan 2024 09:31:36 +0000 (10:31 +0100)] 
AVR: target/113156 - Fix ICE due to missing "Save" on -m[long-]double= options.

Multilib options -mdouble= and -mlong-double= are not orthogonal:
TARGET_HANDLE_OPTION = avr-common.cc::avr_handle_option() sets them
such that  sizeof(double) <= sizeof(long double)  is always true.

gcc/
PR target/113156
* config/avr/avr.opt (-mdouble, -mlong-double): Add "Save" flag.
(-mbranch-cost): Set "Optimization" flag.

(cherry picked from commit f1b0b1e4454d160564090a4cc1fa649ccefdcb1e)

18 months agoDaily bump.
GCC Administrator [Mon, 15 Jan 2024 00:25:01 +0000 (00:25 +0000)] 
Daily bump.

18 months agoPR testsuite/106879 FAIL: gcc.dg/vect/bb-slp-layout-19.c on powerpc64
Jiufu Guo [Tue, 18 Apr 2023 07:56:53 +0000 (15:56 +0800)] 
PR testsuite/106879 FAIL: gcc.dg/vect/bb-slp-layout-19.c on powerpc64

On P7, option -mno-allow-movmisalign is added during testing, which
prevents slp happen on the case.

Like PR65484 and PR87306, this patch use vect_hw_misalign to guard
the case on powerpc targets.

gcc/testsuite/ChangeLog:

PR testsuite/106879
* gcc.dg/vect/bb-slp-layout-19.c: Modify to guard the check with
vect_hw_misalign on POWERs.

18 months agoDaily bump.
GCC Administrator [Sun, 14 Jan 2024 00:25:52 +0000 (00:25 +0000)] 
Daily bump.

18 months agolibgfortran: Emit a space at beginning of internal unit NML.
Jerry DeLisle [Sun, 7 Jan 2024 18:22:19 +0000 (10:22 -0800)] 
libgfortran: Emit a space at beginning of internal unit NML.

PR libgfortran/113223

libgfortran/ChangeLog:

* io/write.c (namelist_write): If internal_unit precede with space.

gcc/testsuite/ChangeLog:

* gfortran.dg/dtio_25.f90: Update.
* gfortran.dg/namelist_57.f90: Update.
* gfortran.dg/namelist_65.f90: Update.

(cherry picked from commit add995ec117d756e61d207041cd32f937c1a1cd9)

18 months agoDaily bump.
GCC Administrator [Sat, 13 Jan 2024 00:26:09 +0000 (00:26 +0000)] 
Daily bump.

18 months agolibgcc, nios2: Fix exception handling on nios2 with -fpic
Sandra Loosemore [Thu, 11 Jan 2024 21:12:56 +0000 (21:12 +0000)] 
libgcc, nios2: Fix exception handling on nios2 with -fpic

Exception handling on nios2-linux-gnu with -fpic has been broken since
revision 790854ea7670f11c14d431c102a49181d2915965, "Use _dl_find_object
in _Unwind_Find_FDE".  For whatever reason, this doesn't work on nios2.

Nios2 uses the GOT address as the base for DW_EH_PE_datarel
relocations in PIC; see my previous fix to make this work, revision
2d33dcfe9f0494c9b56a8d704c3d27c5a4329ebc, "Support for GOT-relative
DW_EH_PE_datarel encoding".  So this may be a horrible bug in the ABI
or in my interpretation of it or just glibc's implementation of
_dl_find_object for this target, but there's existing code out there
that does things this way; and realistically, nobody is going to
re-engineer this now that the vendor has EOL'ed the nios2
architecture.  So, just skip over the code trying to use
_dl_find_object on this target and fall back to the way that works.

libgcc/ChangeLog
* unwind-dw2-fde-dip.c (_Unwind_Find_FDE): Do not try to use
_dl_find_object on nios2; it doesn't work.

(cherry picked from commit cc9cac9f073a9517f5b7fcffcb7c28b166339491)

18 months agoAVR: Work around "sequence of 3 consecutive punctuation characters" warning.
Georg-Johann Lay [Fri, 12 Jan 2024 13:42:45 +0000 (14:42 +0100)] 
AVR: Work around "sequence of 3 consecutive punctuation characters" warning.

gcc/
* config/avr/avr.cc (avr_handle_addr_attribute): Move "..." from
format string to %s argument.

(cherry picked from commit 549ea1487a534d0eef6a424075264ba542514c3d)

18 months agolibstdc++: Fix incorrect PR number in comment
Jonathan Wakely [Thu, 11 Jan 2024 23:09:45 +0000 (23:09 +0000)] 
libstdc++: Fix incorrect PR number in comment

libstdc++-v3/ChangeLog:

* include/std/format (__format::_Arg_store): Fix PR number in
comment. Simplify preprocessor code.

(cherry picked from commit e9035183a20af10a80a97b57accb76699c9c2530)

18 months agoDaily bump.
GCC Administrator [Fri, 12 Jan 2024 00:21:54 +0000 (00:21 +0000)] 
Daily bump.

18 months agolibstdc++: Fix spelling mistake in new doc addition
Jonathan Wakely [Thu, 11 Jan 2024 21:23:48 +0000 (21:23 +0000)] 
libstdc++: Fix spelling mistake in new doc addition

libstdc++-v3/ChangeLog:

* doc/xml/manual/evolution.xml: Fix spelling.
* doc/html/manual/api.html: Regenerate.

(cherry picked from commit 9bac1d7839f129f93f159c27adaf472ee3ab23a2)

18 months agolibstdc++: [_GLIBCXX_DEBUG] Fix assignment of value-initialized iterator [PR112477]
François Dumont [Wed, 10 Jan 2024 18:06:48 +0000 (19:06 +0100)] 
libstdc++: [_GLIBCXX_DEBUG] Fix assignment of value-initialized iterator [PR112477]

Now that _M_Detach do not reset iterator _M_version value we need to reset it when
the iterator is attached to a new sequence. Even if this sequence is null like when
assigning a value-initialized iterator. In this case _M_version shall be reset to 0.

libstdc++-v3/ChangeLog:

PR libstdc++/112477
* src/c++11/debug.cc
(_Safe_iterator_base::_M_attach): Reset _M_version to 0 if attaching to null
sequence.
(_Safe_iterator_base::_M_attach_single): Likewise.
(_Safe_local_iterator_base::_M_attach): Likewise.
(_Safe_local_iterator_base::_M_attach_single): Likewise.
* testsuite/23_containers/map/debug/112477.cc: New test case.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
18 months agolibstdc++: Document addition of libstdc++exp.a
Jonathan Wakely [Thu, 11 Jan 2024 11:27:02 +0000 (11:27 +0000)] 
libstdc++: Document addition of libstdc++exp.a

The API Evolution section of the manual should mention when the
libstdc++exp.a library was added.

libstdc++-v3/ChangeLog:

* doc/xml/manual/evolution.xml: Document addition of
libstdc++exp.a.
* doc/html/*: Regenerate.

(cherry picked from commit a3babd7db769d0aeccb96a494ba3ac3e6f005181)

18 months agotree-object-size: Always set computed bit for bdos [PR113012]
Siddhesh Poyarekar [Mon, 18 Dec 2023 14:44:00 +0000 (09:44 -0500)] 
tree-object-size: Always set computed bit for bdos [PR113012]

It is always safe to set the computed bit for dynamic object sizes at
the end of collect_object_sizes_for because even in case of a dependency
loop encountered in nested calls, we have an SSA temporary to actually
finish the object size expression.  The reexamine pass for dynamic
object sizes is only for propagation of unknowns and gimplification of
the size expressions, not for loop resolution as in the case of static
object sizes.

gcc/ChangeLog:

PR tree-optimization/113012
* tree-object-size.cc (compute_builtin_object_size): Expand
comment for dynamic object sizes.
(collect_object_sizes_for): Always set COMPUTED bitmap for
dynamic object sizes.

gcc/testsuite/ChangeLog:

PR tree-optimization/113012
* gcc.dg/ubsan/pr113012.c: New test case.

Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
(cherry picked from commit 576c1fc4401a9dae9757ac2e4fa37d05e130fa3d)

18 months agolibstdc++: Fix error handling in filesystem::equivalent [PR113250]
Ken Matsui [Thu, 11 Jan 2024 06:08:07 +0000 (22:08 -0800)] 
libstdc++: Fix error handling in filesystem::equivalent [PR113250]

This patch made std::filesystem::equivalent correctly throw an exception
when either path does not exist as per [fs.op.equivalent]/4.

PR libstdc++/113250

libstdc++-v3/ChangeLog:

* src/c++17/fs_ops.cc (fs::equivalent): Use || instead of &&.
* src/filesystem/ops.cc (fs::equivalent): Likewise.
* testsuite/27_io/filesystem/operations/equivalent.cc: Handle
error codes.
* testsuite/experimental/filesystem/operations/equivalent.cc:
Likewise.

Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
(cherry picked from commit df147e2ee7199d33d66959c6509ce9c21072077f)

18 months agoDaily bump.
GCC Administrator [Thu, 11 Jan 2024 00:22:56 +0000 (00:22 +0000)] 
Daily bump.

18 months agolibstdc++: Add Filesystem TS and std::stacktrace symbols to libstdc++exp.a
Jonathan Wakely [Thu, 7 Sep 2023 09:24:56 +0000 (10:24 +0100)] 
libstdc++: Add Filesystem TS and std::stacktrace symbols to libstdc++exp.a

This consolidates the three static archives for extensions into one, so
that -lstdc++exp can be used to provide the definitions of all unstable
library features.

For this gcc-13 backport libstdc++_libbacktrace.a is still installed,
but its contents are duplicated in libstdc++exp.a. This means that users
can start using -lstdc++exp with GCC 13.3 if they want, but existing
Makefiles can continue to use -lstdc++_libbacktrace for any GCC 13.x
release.

The libstdc++fs.a archive is still installed, but its contents are
duplicated in libstdc++exp.a now. This means -lstdc++exp can be used
instead of -lstdc++fs. For targets using the GNU linker we should
consider replacing libstdc++fs.a with a linker script that does
INPUT(libstdc++exp.a).

The tests for <experimental/filesystem> could be changed to use
-lstdc++exp instead of -lstdc++fs, which would allow removing
src/filesystem/.libs from the LDFLAGS in scripts/testsuite_flags.in,
but that can be done at a later date.

libstdc++-v3/ChangeLog:

* doc/html/manual/*: Regenerate.
* doc/xml/manual/using.xml: Update documentation on linking.
* scripts/testsuite_flags.in: Adjust LDFLAGS to find
libstdc++exp instead of libstdc++_libbacktrace.
* src/c++20/Makefile.am: Fix comment.
* src/c++20/Makefile.in: Regenerate.
* src/experimental/Makefile.am: Use LIBADD to include other
libraries.
* src/experimental/Makefile.in: Regenerate.
* testsuite/19_diagnostics/stacktrace/current.cc: Adjust
dg-options to use -lstdc++exp.
* testsuite/19_diagnostics/stacktrace/entry.cc: Likewise.
* testsuite/19_diagnostics/stacktrace/stacktrace.cc: Likewise.
* testsuite/23_containers/vector/debug/assign4_backtrace_neg.cc:
Likewise.

(cherry picked from commit b96b554592c5cbb6a2c1797ffcb5706fd295f4fd)

18 months agoDaily bump.
GCC Administrator [Wed, 10 Jan 2024 00:21:32 +0000 (00:21 +0000)] 
Daily bump.

18 months agoFix internal error on function call returning extension of limited interface
Eric Botcazou [Tue, 9 Jan 2024 10:06:23 +0000 (11:06 +0100)] 
Fix internal error on function call returning extension of limited interface

The problem occurs when this function call is the expression of a return in
a function returning the limited interface; in this peculiar case, there is
a mismatch between the callee, which has BIP formals but is not a BIP call,
and the caller, which is a BIP function, that is spotted by an assertion.

This is fixed by restoring the semantics of Is_Build_In_Place_Function_Call,
which returns again true only for calls to BIP functions, introducing the
Is_Function_Call_With_BIP_Formals predicate, which also returns true for
calls to functions with BIP formals that are not BIP functions, and moving
down the assertion in Expand_Simple_Function_Return.

gcc/ada/
PR ada/112781
* exp_ch6.ads (Is_Build_In_Place_Function): Adjust description.
* exp_ch6.adb (Is_True_Build_In_Place_Function_Call): Delete.
(Is_Function_Call_With_BIP_Formals): New predicate.
(Is_Build_In_Place_Function_Call): Restore original semantics.
(Expand_Call_Helper): Adjust conditions guarding the calls to
Add_Dummy_Build_In_Place_Actuals to above renaming.
(Expand_N_Extended_Return_Statement): Adjust to above renaming.
(Expand_Simple_Function_Return): Likewise.  Move the assertion
to after the transformation into an extended return statement.
(Make_Build_In_Place_Call_In_Allocator): Remove unreachable code.
(Make_Build_In_Place_Call_In_Assignment): Likewise.

gcc/testsuite/
* gnat.dg/bip_prim_func2.adb: New test.
* gnat.dg/bip_prim_func2_pkg.ads, gnat.dg/bip_prim_func2_pkg.adb:
New helper package.