]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
17 months agoDaily bump.
GCC Administrator [Tue, 13 Feb 2024 00:21:30 +0000 (00:21 +0000)] 
Daily bump.

17 months agoavr: Fix wrong array bounds warning on SFR access
Senthil Kumar Selvaraj [Mon, 19 Jun 2023 06:53:25 +0000 (12:23 +0530)] 
avr: Fix wrong array bounds warning on SFR access

The warning was raised on accessing SFRs at addresses below the default
page size, as gcc considers accessing addresses in the first page of
memory as suspicious. This doesn't apply to an embedded target like the
avr, where both flash and RAM have zero as a valid address. Zero is also
a valid address in named address spaces (__memx, flash<n> etc..).

This commit implements TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID for the avr
target and reports to gcc that zero is a valid address on all
address spaces. It also disables flag_delete_null_pointer_checks
based on the target hook, and modifies target-supports.exp to add avr
to the list of targets that always keep null pointer checks. This fixes
a bunch of DejaGNU failures that occur otherwise.

PR target/105523

gcc/ChangeLog:

* common/config/avr/avr-common.cc: Remove setting
of OPT_fdelete_null_pointer_checks.
* config/avr/avr.cc (avr_option_override): Clear
flag_delete_null_pointer_checks if zero_address_valid.
(avr_addr_space_zero_address_valid): New function.
(TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID): Provide target
hook.

gcc/testsuite/ChangeLog:

* lib/target-supports.exp
(check_effective_target_keeps_null_pointer_checks): Add
avr.
* gcc.target/avr/pr105523.c: New test.

(cherry picked from commit 58e1bc2b1c8420773b16452d47932a6ca0d003fb)

17 months agoDaily bump.
GCC Administrator [Mon, 12 Feb 2024 00:21:20 +0000 (00:21 +0000)] 
Daily bump.

17 months agolibgfortran: avoid duplicate libraries in spec
Francois-Xavier Coudert [Sun, 11 Feb 2024 13:42:24 +0000 (14:42 +0100)] 
libgfortran: avoid duplicate libraries in spec

The linking of libgcc is already present in %(liborig), so the current
situation duplicates libraries. This was not an issue until macOS's new
linker started giving warnings for such cases.

libgfortran/ChangeLog:

PR libfortran/110651
* libgfortran.spec.in: Remove duplicate libraries.

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

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

17 months agocall maybe_return_this in build_clone
Alexandre Oliva [Wed, 29 Nov 2023 07:00:35 +0000 (04:00 -0300)] 
call maybe_return_this in build_clone

__dt_base doesn't get its body from a maybe_return_this caller, it's
rather cloned with the full body within build_clone, and then it's
left alone, without going through finish_function_body or
build_delete_destructor_body, that call maybe_return_this.

Now, this is correct as far as the generated code is concerned, since
the cloned body of a cdtor that returns this is also a cdtor body that
returns this.  The problem is that the decl for THIS is also cloned,
and it doesn't get the warning suppression introduced by
maybe_return_this, so Wuse-after-free3.C fails with an excess warning
at the closing brace of the dtor body.

I've split out the warning suppression from maybe_return_this, and
arranged to call that bit from the relevant build_clone case.
Unfortunately, because the warning is silenced for all uses of the
THIS decl, rather than only for the ABI-mandated return stmt, this
also silences the very warning that the testcase checks for.

I'm not revamping the warning suppression approach to overcome this,
so I'm xfailing the expected warning on ARM EABI, hoping that's the
only target with cdtor_return_this, and leaving it at that.

for  gcc/cp/ChangeLog

* decl.cc (maybe_prepare_return_this): Split out of...
(maybe_return_this): ... this.
* cp-tree.h (maybe_prepare_return_this): Declare.
* class.cc (build_clone): Call it.

for  gcc/testsuite/ChangeLog

* g++.dg/warn/Wuse-after-free3.C: xfail on arm_eabi.

(cherry picked from commit 0d24289d129639efdc79338a64188d6d404375e8)

18 months ago[testsuite] tsvc: skip include malloc.h when unavailable
Alexandre Oliva [Wed, 24 May 2023 06:07:46 +0000 (03:07 -0300)] 
[testsuite] tsvc: skip include malloc.h when unavailable

tsvc tests all fail on systems that don't offer a malloc.h, other than
those that explicitly rule that out.  Use the preprocessor to test for
malloc.h's availability.

tsvc.h also expects a definition for struct timeval, but it doesn't
include sys/time.h.  Add a conditional include thereof.

for  gcc/testsuite/ChangeLog

* gcc.dg/vect/tsvc/tsvc.h: Test for and conditionally include
malloc.h and sys/time.h.

(cherry picked from commit 2f20d6296087cae51f55eeecb3efefe786191fd6)

18 months agotestsuite: Pattern does not match when using --specs=nano.specs
Torbjörn SVENSSON [Tue, 6 Feb 2024 16:58:26 +0000 (17:58 +0100)] 
testsuite: Pattern does not match when using --specs=nano.specs

When running the testsuite for newlib nano, the --specs=nano.specs
option is used.  This option prepends cpp_unique_options with
"-isystem =/include/newlib-nano" so that the newlib nano header files
override the newlib standard ones.  As the -isystem option is prepended,
the -quiet option is no longer the first option to cc1.  Adjust the test
accordingly.

Patch has been verified on Windows and Linux.

gcc/testsuite/ChangeLog:

* gcc.misc-tests/options.exp: Allow other options before the
-quite option for cc1.

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

18 months agoc++: for contracts, cdtors never return this
Alexandre Oliva [Wed, 29 Nov 2023 07:00:28 +0000 (04:00 -0300)] 
c++: for contracts, cdtors never return this

When targetm.cxx.cdtor_return_this() holds, cdtors have a
non-VOID_TYPE_P result, but IMHO this ABI implementation detail
shouldn't leak to the abstract language conceptual framework, in which
cdtors don't have return values.  For contracts, specifically those
that establish postconditions on results, such a leakage is present,
and the present patch puts an end to it: with it, cdtors get an error
for result postconditions regardless of the ABI.  This fixes
g++.dg/contracts/contracts-ctor-dtor2.C on arm-eabi.

for  gcc/cp/ChangeLog

* contracts.cc (check_postcondition_result): Cope with
cdtor_return_this.

(cherry picked from commit 71804526d3a71a8c0f189a89ce3aa615784bfd8b)

18 months agolibstdc++: Do not use assume attribute for Clang [PR112467]
Jonathan Wakely [Fri, 10 Nov 2023 21:06:15 +0000 (21:06 +0000)] 
libstdc++: Do not use assume attribute for Clang [PR112467]

Clang has an 'assume' attribute, but it's a function attribute not a
statement attribute. The recently-added use of the statement form causes
an error with Clang.

libstdc++-v3/ChangeLog:

PR libstdc++/112467
* include/bits/stl_bvector.h (_M_assume_normalized): Do not use
statement form of assume attribute for Clang.

(cherry picked from commit 807f47497f17ed50be91f0f879308cb6fa063966)

18 months agolibstdc++: optimize bit iterators assuming normalization [PR110807]
Alexandre Oliva [Thu, 9 Nov 2023 03:01:37 +0000 (00:01 -0300)] 
libstdc++: optimize bit iterators assuming normalization [PR110807]

The representation of bit iterators, using a pointer into an array of
words, and an unsigned bit offset into that word, makes for some
optimization challenges: because the compiler doesn't know that the
offset is always in a certain narrow range, beginning at zero and
ending before the word bitwidth, when a function loads an offset that
it hasn't normalized itself, it may fail to derive certain reasonable
conclusions, even to the point of retaining useless calls that elicit
incorrect warnings.

Case at hand: The 110807.cc testcase for bit vectors assigns a 1-bit
list to a global bit vector variable.  Based on the compile-time
constant length of the list, we decide in _M_insert_range whether to
use the existing storage or to allocate new storage for the vector.
After allocation, we decide in _M_copy_aligned how to copy any
preexisting portions of the vector to the newly-allocated storage.
When copying two or more words, we use __builtin_memmove.

However, because we compute the available room using bit offsets
without range information, even comparing them with constants, we fail
to infer ranges for the preexisting vector depending on word size, and
may thus retain the memmove call despite knowing we've only allocated
one word.

Other parts of the compiler then detect the mismatch between the
constant allocation size and the much larger range that could
theoretically be copied into the newly-allocated storage if we could
reach the call.

Ensuring the compiler is aware of the constraints on the offset range
enables it to do a much better job at optimizing.  Using attribute
assume (_M_offset <= ...) didn't work, because gimple lowered that to
something that vrp could only use to ensure 'this' was non-NULL.
Exposing _M_offset as an automatic variable/gimple register outside
the unevaluated assume operand enabled the optimizer to do its job.

Rather than placing such load-then-assume constructs all over, I
introduced an always-inline member function in bit iterators that does
the job of conveying to the compiler the information that the
assumption is supposed to hold, and various calls throughout functions
pertaining to bit iterators that might not otherwise know that the
offsets have to be in range, so that the compiler no longer needs to
make conservative assumptions that prevent optimizations.

With the explicit assumptions, the compiler can correlate the test for
available storage in the vector with the test for how much storage
might need to be copied, and determine that, if we're not asking for
enough room for two or more words, we can omit entirely the code to
copy two or more words, without any runtime overhead whatsoever: no
traces remain of the undefined behavior or of the tests that inform
the compiler about the assumptions that must hold.

for  libstdc++-v3/ChangeLog

PR libstdc++/110807
* include/bits/stl_bvector.h (_Bit_iterator_base): Add
_M_assume_normalized member function.  Call it in _M_bump_up,
_M_bump_down, _M_incr, operator==, operator<=>, operator<, and
operator-.
(_Bit_iterator): Also call it in operator*.
(_Bit_const_iterator): Likewise.

(cherry picked from commit e39b3e02c27bd771a07e385f9672ecf1a45ced77)

18 months agoDaily bump.
GCC Administrator [Fri, 9 Feb 2024 00:22:59 +0000 (00:22 +0000)] 
Daily bump.

18 months agolibstdc++: Prefer posix_memalign for aligned-new [PR113258]
Jonathan Wakely [Tue, 9 Jan 2024 15:22:46 +0000 (15:22 +0000)] 
libstdc++: Prefer posix_memalign for aligned-new [PR113258]

As described in PR libstdc++/113258 there are old versions of tcmalloc
which replace malloc and related APIs, but do not repalce aligned_alloc
because it didn't exist at the time they were released. This means that
when operator new(size_t, align_val_t) uses aligned_alloc to obtain
memory, it comes from libc's aligned_alloc not from tcmalloc. But when
operator delete(void*, size_t, align_val_t) uses free to deallocate the
memory, that goes to tcmalloc's replacement version of free, which
doesn't know how to free it.

If we give preference to the older posix_memalign instead of
aligned_alloc then we're more likely to use a function that will be
compatible with the replacement version of free. Because posix_memalign
has been around for longer, it's more likely that old third-party malloc
replacements will also replace posix_memalign alongside malloc and free.

libstdc++-v3/ChangeLog:

PR libstdc++/113258
* libsupc++/new_opa.cc: Prefer to use posix_memalign if
available.

(cherry picked from commit f50f2efae9fb0965d8ccdb62cfdb698336d5a933)

18 months agolibstdc++: Fix non-portable results from 64-bit std::subtract_with_carry_engine ...
Jonathan Wakely [Thu, 11 Jan 2024 15:09:12 +0000 (15:09 +0000)] 
libstdc++: Fix non-portable results from 64-bit std::subtract_with_carry_engine [PR107466]

I implemented the resolution of LWG 3809 in r13-4364-ga64775a0edd469 but
it was recently noted in the MSVC STL github repo that the change causes
possible truncation for 64-bit seeds. Whether the truncation occurs (and
to what value) depends on the width of uint_least32_t which is not
portable, so the output of the PRNG for 64-bit seed values is no longer
the same as in C++20, and no longer portable across platforms.

That new issue was filed as LWG 4014. I proposed a new change which
reduces the seed by the LCG's modulus before the conversion to
uint_least32_t. This ensures that 64-bit seed values are consistently
reduced by the modulus before any truncation. This removes the
platform-dependent behaviour and restores the old behaviour for
std::subtract_with_carry_engine specializations using a 64-bit result
type (such as std::ranlux48_base).

libstdc++-v3/ChangeLog:

PR libstdc++/107466
* include/bits/random.tcc (subtract_with_carry_engine::seed):
Implement proposed resolution of LWG 4014.
* testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error
line number.
* testsuite/26_numerics/random/subtract_with_carry_engine/cons/lwg3809.cc:
Check for expected result of 64-bit engine with seed that
doesn't fit in 32-bits.

(cherry picked from commit c224dec0e7c88e7a95633023018cdcb6ee87c65f)

18 months agolibstdc++: Implement some missing functions for net::ip::network_v6
Jonathan Wakely [Thu, 1 Feb 2024 10:08:05 +0000 (10:08 +0000)] 
libstdc++: Implement some missing functions for net::ip::network_v6

libstdc++-v3/ChangeLog:

* include/experimental/internet (network_v6::network): Define.
(network_v6::hosts): Finish implementing.
(network_v6::to_string): Do not concatenate std::string to
arbitrary std::basic_string specialization.
* testsuite/experimental/net/internet/network/v6/cons.cc: New
test.

(cherry picked from commit 5b069117e261ae0b438aee0cdff8707827810adf)

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.