]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
2 months agoDaily bump.
GCC Administrator [Mon, 1 Sep 2025 00:22:26 +0000 (00:22 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Sun, 31 Aug 2025 00:24:52 +0000 (00:24 +0000)] 
Daily bump.

2 months agoRevert "Fix _Decimal128 arithmetic error under FE_UPWARD."
liuhongt [Sat, 30 Aug 2025 02:24:20 +0000 (19:24 -0700)] 
Revert "Fix _Decimal128 arithmetic error under FE_UPWARD."

This reverts commit 44287e850b94de27c3a398fd75936a962c12b1b8.

2 months agoDaily bump.
GCC Administrator [Sat, 30 Aug 2025 00:22:35 +0000 (00:22 +0000)] 
Daily bump.

2 months agoFix _Decimal128 arithmetic error under FE_UPWARD.
liuhongt [Thu, 28 Aug 2025 01:20:09 +0000 (18:20 -0700)] 
Fix _Decimal128 arithmetic error under FE_UPWARD.

libgcc/config/libbid/ChangeLog:

PR target/120691
* bid128_div.c: Fix _Decimal128 arithmetic error under
FE_UPWARD.
* bid128_rem.c: Ditto.
* bid128_sqrt.c: Ditto.
* bid64_div.c (bid64_div): Ditto.
* bid64_sqrt.c (bid64_sqrt): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr120691.c: New test.

(cherry picked from commit 50064b2898edfb83bc37f2597a35cbd3c1c853e3)

2 months agoDaily bump.
GCC Administrator [Fri, 29 Aug 2025 00:23:39 +0000 (00:23 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Thu, 28 Aug 2025 00:23:50 +0000 (00:23 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Wed, 27 Aug 2025 00:23:02 +0000 (00:23 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Tue, 26 Aug 2025 00:24:01 +0000 (00:24 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Mon, 25 Aug 2025 00:22:10 +0000 (00:22 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Sun, 24 Aug 2025 00:22:59 +0000 (00:22 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Sat, 23 Aug 2025 00:22:59 +0000 (00:22 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Fri, 22 Aug 2025 00:23:23 +0000 (00:23 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Thu, 21 Aug 2025 00:23:55 +0000 (00:23 +0000)] 
Daily bump.

2 months agoAVR: target/121608 - Don't add --relax when linking with -r.
Georg-Johann Lay [Wed, 20 Aug 2025 08:53:37 +0000 (10:53 +0200)] 
AVR: target/121608 - Don't add --relax when linking with -r.

The linker rejects --relax in relocatable links (-r), hence only
add --relax when -r is not specified.

gcc/
PR target/121608
* config/avr/specs.h (LINK_RELAX_SPEC): Wrap in %{!r...}.

(cherry picked from commit 0f15ff7b511493e9197e6153b794081c1557ba02)

2 months agoDaily bump.
GCC Administrator [Wed, 20 Aug 2025 00:22:34 +0000 (00:22 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Tue, 19 Aug 2025 00:23:23 +0000 (00:23 +0000)] 
Daily bump.

2 months agoaarch64: Fix mode mismatch when building a predicate [PR121118]
Richard Sandiford [Mon, 18 Aug 2025 15:11:21 +0000 (16:11 +0100)] 
aarch64: Fix mode mismatch when building a predicate [PR121118]

This PR is about a case where we used aarch64_expand_sve_const_pred_trn
to combine two predicates, one of which was constructing using
aarch64_sve_move_pred_via_while.  The former requires the inputs
to have mode VNx16BI, but the latter returned VNx8BI for a .H
WHILELO.

The proper fix, used on trunk, is to make the pattern emitted by
aarch64_sve_move_pred_via_while produce an VNx16BI for all element
sizes, since every bit of the result is significant.  However,
that required some target-independent changes that are too invasive
to backport.  This patch goes for the simpler (but less robust) approach
of using the original pattern and casting it to VNx16BI after the fact.

Since the WHILELO pattern is an unspec, the chances of something
optimising it in a way that changes the undefined bits of the output
should be very low, especially on a release branch.  It is still a less
satisfactory fix though.

gcc/
PR target/121118
* config/aarch64/aarch64.cc (aarch64_sve_move_pred_via_while):
Return a VNx16BI predicate.

gcc/testsuite/
PR target/121118
* gcc.target/aarch64/sve/acle/general/pr121118_1.c: New test.

(cherry picked from commit 58a9717df098defb7f595fbc56122107e952a46b)

2 months agofwprop: Don't propagate asms [PR121253]
Richard Sandiford [Mon, 18 Aug 2025 15:11:19 +0000 (16:11 +0100)] 
fwprop: Don't propagate asms [PR121253]

For the reasons explained in the comment, fwprop shouldn't even
try to propagate an asm definition.

gcc/
PR rtl-optimization/121253
* fwprop.cc (forward_propagate_into): Don't propagate asm defs.

gcc/testsuite/
PR rtl-optimization/121253
* gcc.target/aarch64/pr121253.c: New test.

(cherry picked from commit e82c8413eda498163ae2e0ecc458ea0428708c30)

2 months agoDaily bump.
GCC Administrator [Mon, 18 Aug 2025 00:21:57 +0000 (00:21 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Sun, 17 Aug 2025 00:22:53 +0000 (00:22 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Sat, 16 Aug 2025 00:23:10 +0000 (00:23 +0000)] 
Daily bump.

2 months agoAArch64: Fix invalid immediate offsets in SVE gather/scatter [PR121449]
Pengfei Li [Thu, 14 Aug 2025 13:59:48 +0000 (13:59 +0000)] 
AArch64: Fix invalid immediate offsets in SVE gather/scatter [PR121449]

This patch fixes incorrect constraints in RTL patterns for AArch64 SVE
gather/scatter with type widening/narrowing and vector-plus-immediate
addressing. The bug leads to below "immediate offset out of range"
errors during assembly, eventually causing compilation failures.

/tmp/ccsVqBp1.s: Assembler messages:
/tmp/ccsVqBp1.s:54: Error: immediate offset out of range 0 to 31 at operand 3 -- `ld1b z1.d,p0/z,[z1.d,#64]'

Current RTL patterns for such instructions incorrectly use vgw or vgd
constraints for the immediate operand, base on the vector element type
in Z registers (zN.s or zN.d). However, for gather/scatter with type
conversions, the immediate range for vector-plus-immediate addressing is
determined by the element type in memory, which differs from that in
vector registers. Using the wrong constraint can produce out-of-range
offset values that cannot be encoded in the instruction.

This patch corrects the constraints used in these patterns. A test case
that reproduces the issue is also included.

Bootstrapped and regression-tested on aarch64-linux-gnu.

gcc/ChangeLog:
PR target/121449
* config/aarch64/aarch64-sve.md
(mask_gather_load<mode><v_int_container>): Use vg<Vesize>
constraints for alternatives with immediate offset.
(mask_scatter_store<mode><v_int_container>): Likewise.

gcc/testsuite/ChangeLog:
PR target/121449
* g++.target/aarch64/sve/pr121449.C: New test.

2 months agoDaily bump.
GCC Administrator [Fri, 15 Aug 2025 00:22:19 +0000 (00:22 +0000)] 
Daily bump.

2 months agoaarch64: Use VNx16BI for svrev_b* [PR121294]
Richard Sandiford [Thu, 14 Aug 2025 20:55:28 +0000 (21:55 +0100)] 
aarch64: Use VNx16BI for svrev_b* [PR121294]

The previous patch for PR121294 handled svtrn1/2, svuzp1/2, and svzip1/2.
This one extends it to handle svrev intrinsics, where the same kind of
wrong code can be generated.

gcc/
PR target/121294
* config/aarch64/aarch64.md (UNSPEC_REV_PRED): New unspec.
* config/aarch64/aarch64-sve.md (@aarch64_sve_rev<mode>_acle)
(*aarch64_sve_rev<mode>_acle): New patterns.
* config/aarch64/aarch64-sve-builtins-base.cc
(svrev_impl::expand): Use the new patterns for boolean svrev.

gcc/testsuite/
PR target/121294
* gcc.target/aarch64/sve/acle/general/rev_2.c: New test.

(cherry picked from commit 701193a7a6d3f3f345bf336e7ebc7d6fa1e0c5ac)

2 months agoaarch64: Use VNx16BI for more permutations [PR121294]
Richard Sandiford [Thu, 14 Aug 2025 20:55:28 +0000 (21:55 +0100)] 
aarch64: Use VNx16BI for more permutations [PR121294]

The patterns for the predicate forms of svtrn1/2, svuzp1/2,
and svzip1/2 are shared with aarch64_vectorize_vec_perm_const.
The .H, .S, and .D forms operate on VNx8BI, VNx4BI, and VNx2BI
respectively.  Thus, for all four element widths, there is one
significant bit per element, for both the inputs and the output.

That's appropriate for aarch64_vectorize_vec_perm_const but not
for the ACLE intrinsics, where every bit of the output is
significant, and where every bit of the selected input elements
is therefore also significant.  The current expansion can lead
the optimisers to simplify inputs by changing the upper bits
of the input elements (since the current patterns claim that
those bits don't matter), which in turn leads to wrong code.

The ACLE expansion should operate on VNx16BI instead, for all
element widths.

There was already a pattern for a VNx16BI-only form of TRN1, for
constructing certain predicate constants.  The patch generalises it to
handle the other five permutations as well.  For the reasons given in
the comments, this is done by making the permutation unspec an operand
to a new UNSPEC_PERMUTE_PRED, rather than overloading the existing
unspecs, and rather than adding a new unspec for each permutation.

gcc/
PR target/121294
* config/aarch64/iterators.md (UNSPEC_TRN1_CONV): Delete.
(UNSPEC_PERMUTE_PRED): New unspec.
* config/aarch64/aarch64-sve.md (@aarch64_sve_trn1_conv<mode>):
Replace with...
(@aarch64_sve_<perm_insn><mode>_acle)
(*aarch64_sve_<perm_insn><mode>_acle): ...these new patterns.
* config/aarch64/aarch64.cc (aarch64_expand_sve_const_pred_trn):
Update accordingly.
* config/aarch64/aarch64-sve-builtins-functions.h
(binary_permute::expand): Use the new _acle patterns for
predicate operations.

gcc/testsuite/
PR target/121294
* gcc.target/aarch64/sve/acle/general/perm_2.c: New test.
* gcc.target/aarch64/sve/acle/general/perm_3.c: Likewise.
* gcc.target/aarch64/sve/acle/general/perm_4.c: Likewise.
* gcc.target/aarch64/sve/acle/general/perm_5.c: Likewise.
* gcc.target/aarch64/sve/acle/general/perm_6.c: Likewise.
* gcc.target/aarch64/sve/acle/general/perm_7.c: Likewise.

(cherry picked from commit 4cf9d4ebdd68a724eb41044cd8f2a4d466d81c7f)

2 months agox86: Pass -mno-80387 to compile pr121208-1(a|b).c
H.J. Lu [Tue, 29 Jul 2025 16:11:34 +0000 (09:11 -0700)] 
x86: Pass -mno-80387 to compile pr121208-1(a|b).c

Pass -mno-80387 to compile pr121208-1(a|b).c to silence

.../pr121208-1a.c:11:1: sorry, unimplemented: 80387 instructions aren’t allowed in a function with the ‘no_caller_saved_registers’ attribute

Partially backport the PR target/121540 fix

9d7f45e9806 x86: Disallow MMX and 80387 in no_caller_saved_registers function

to also add -mno-sse -mno-mmx.

PR target/121208
* gcc.target/i386/pr121208-1a.c (dg-options): Add
-mno-sse -mno-mmx -mno-80387.
* gcc.target/i386/pr121208-1b.c (dg-options): Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit c6d1f58da7eb72e8bac307d342e4655012b36a89)

2 months agox86: Disallow -mtls-dialect=gnu with no_caller_saved_registers
H.J. Lu [Thu, 24 Jul 2025 14:38:13 +0000 (07:38 -0700)] 
x86: Disallow -mtls-dialect=gnu with no_caller_saved_registers

__tls_get_addr doesn't preserve vector registers.  When a function
with no_caller_saved_registers attribute calls __tls_get_addr, YMM
and ZMM registers will be clobbered.  Issue an error and suggest
-mtls-dialect=gnu2 in this case.

gcc/

PR target/121208
* config/i386/i386.cc (ix86_tls_get_addr): Issue an error for
-mtls-dialect=gnu with no_caller_saved_registers attribute and
suggest -mtls-dialect=gnu2.

gcc/testsuite/

PR target/121208
* gcc.target/i386/pr121208-1a.c: New test.
* gcc.target/i386/pr121208-1b.c: Likewise.
* gcc.target/i386/pr121208-2a.c: Likewise.
* gcc.target/i386/pr121208-2b.c: Likewise.
* gcc.target/i386/pr121208-3a.c: Likewise.
* gcc.target/i386/pr121208-3b.c: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit 5760ddbce26ff9c5c8851b6b2089ad65981d5078)

2 months agoDaily bump.
GCC Administrator [Thu, 14 Aug 2025 00:21:50 +0000 (00:21 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Wed, 13 Aug 2025 00:21:16 +0000 (00:21 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Tue, 12 Aug 2025 00:21:08 +0000 (00:21 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Mon, 11 Aug 2025 00:19:08 +0000 (00:19 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Sun, 10 Aug 2025 00:22:05 +0000 (00:22 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Sat, 9 Aug 2025 00:22:09 +0000 (00:22 +0000)] 
Daily bump.

2 months agoc++: constexpr evaluation of abi::__dynamic_cast [PR120620]
Patrick Palka [Mon, 4 Aug 2025 20:43:33 +0000 (16:43 -0400)] 
c++: constexpr evaluation of abi::__dynamic_cast [PR120620]

r13-3299 changed our internal declaration of __dynamic_cast to reside
inside the abi/__cxxabiv1:: namespace instead of the global namespace,
matching the real declaration.  This inadvertently made us now attempt
constexpr evaluation of user-written calls to abi::__dynamic_cast since
cxx_dynamic_cast_fn_p now also returns true for them, but we're not
prepared to handle arbitrary calls to __dynamic_cast, and therefore ICE.

This patch restores cxx_dynamic_cast_fn_p to return true only for
synthesized calls to __dynamic_cast, which can be distinguished by
DECL_ARTIFICIAL, since apparently the synthesized declaration of
__dynamic_cast doesn't get merged with the actual declaration.

PR c++/120620

gcc/cp/ChangeLog:

* constexpr.cc (cxx_dynamic_cast_fn_p): Return true only
for synthesized __dynamic_cast.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/constexpr-dynamic19.C: New test.
* g++.dg/cpp2a/constexpr-dynamic1a.C: New test.

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

3 months agoDaily bump.
GCC Administrator [Fri, 8 Aug 2025 00:21:52 +0000 (00:21 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Thu, 7 Aug 2025 00:23:57 +0000 (00:23 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Wed, 6 Aug 2025 00:23:37 +0000 (00:23 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Tue, 5 Aug 2025 00:22:30 +0000 (00:22 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Mon, 4 Aug 2025 00:23:03 +0000 (00:23 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Sun, 3 Aug 2025 00:22:15 +0000 (00:22 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Sat, 2 Aug 2025 00:23:27 +0000 (00:23 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Fri, 1 Aug 2025 00:23:25 +0000 (00:23 +0000)] 
Daily bump.

3 months agotestsuite: Fix gcc.target/powerpc/vsx-builtin-7.c test [PR119382]
Jeevitha [Thu, 31 Jul 2025 12:00:35 +0000 (07:00 -0500)] 
testsuite: Fix gcc.target/powerpc/vsx-builtin-7.c test [PR119382]

The test vsx-builtin-7.c failed on powerpc64le-linux due to Identical
Code Folding (ICF) merging the functions insert_di_0_v2 and insert_di_0.
This behavior was introduced by commit r15-7961-gdc47161c1f32c3, which
enhanced alias analysis in ao_compare::compare_ao_refs, enabling the
compiler to identify and optimize structurally identical functions. As a
result, the compiler replaced insert_di_0_v2 with a tail call to
insert_di_0, altering the expected test behavior.

This patch adds -fno-ipa-icf to the test's dg-options to disable ICF,
avoiding function merging and ensuring the test executes correctly.

2025-06-24  Jeevitha Palanisamy  <jeevitha@linux.ibm.com>

gcc/testsuite/
PR testsuite/119382
* gcc.target/powerpc/vsx-builtin-7.c: Add '-fno-ipa-icf' to dg-options.

(cherry picked from commit a1fb757342058111fddcdc5ca2f866c61e87c9b8)

3 months agox86: Transform to "pushq $-1; popq reg" for -Oz
H.J. Lu [Tue, 29 Jul 2025 18:22:35 +0000 (11:22 -0700)] 
x86: Transform to "pushq $-1; popq reg" for -Oz

commit 4c80062d7b8c272e2e193b8074a8440dbb4fe588
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun May 25 07:40:29 2025 +0800

    x86: Enable *mov<mode>_(and|or) only for -Oz

disabled transformation from "movq $-1,reg" to "pushq $-1; popq reg" for
-Oz.  But for legacy integer registers, the former is 4 bytes and the
latter is 3 bytes.  Enable such transformation for -Oz.

gcc/

PR target/120427
* config/i386/i386.md (peephole2): Transform "movq $-1,reg" to
"pushq $-1; popq reg" for -Oz if reg is a legacy integer register.

gcc/testsuite/

PR target/120427
* gcc.target/i386/pr120427-5.c: New test.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit 71dae74158d05b75e367629ce21da3f0a2945576)

3 months ago[sanitizer_common] Remove reference to obsolete termio ioctls (#138822)
Sam James [Fri, 25 Jul 2025 18:45:18 +0000 (19:45 +0100)] 
[sanitizer_common] Remove reference to obsolete termio ioctls (#138822)

Cherry picked from LLVM commit c99b1bcd505064f2e086e6b1034ce0b0c91ea5b9.

The termio ioctls are no longer used after commit 59978b21ad9c
("[sanitizer_common] Remove interceptors for deprecated struct termio
(#137403)"), remove them.  Fixes this build error:

../../../../libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp:765:27: error: invalid application of ‘sizeof’ to incomplete type ‘__sanitizer::termio’
  765 |   unsigned IOCTL_TCGETA = TCGETA;
      |                           ^~~~~~
../../../../libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp:769:27: error: invalid application of ‘sizeof’ to incomplete type ‘__sanitizer::termio’
  769 |   unsigned IOCTL_TCSETA = TCSETA;
      |                           ^~~~~~
../../../../libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp:770:28: error: invalid application of ‘sizeof’ to incomplete type ‘__sanitizer::termio’
  770 |   unsigned IOCTL_TCSETAF = TCSETAF;
      |                            ^~~~~~~
../../../../libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp:771:28: error: invalid application of ‘sizeof’ to incomplete type ‘__sanitizer::termio’
  771 |   unsigned IOCTL_TCSETAW = TCSETAW;
      |                            ^~~~~~~

(cherry picked from commit dbe0ba6c90d53229613c7eb3f476580ae1b9aae1)

3 months agolibsanitizer: Fix build with glibc 2.42
Florian Weimer [Fri, 2 May 2025 15:41:43 +0000 (17:41 +0200)] 
libsanitizer: Fix build with glibc 2.42

The termio structure will be removed from glibc 2.42.  It has
been deprecated since the late 80s/early 90s.

Cherry-picked from LLVM commit 59978b21ad9c65276ee8e14f26759691b8a65763
("[sanitizer_common] Remove interceptors for deprecated struct termio
(#137403)").

Co-Authored-By: Tom Stellard <tstellar@redhat.com>
libsanitizer/

* sanitizer_common/sanitizer_common_interceptors_ioctl.inc: Cherry
picked from LLVM commit 59978b21ad9c65276ee8e14f26759691b8a65763.
* sanitizer_common/sanitizer_platform_limits_posix.cpp: Likewise.
* sanitizer_common/sanitizer_platform_limits_posix.h: Likewise.

(cherry picked from commit 1789c57dc97ea2f9819ef89e28bf17208b6208e7)

3 months agoDaily bump.
GCC Administrator [Thu, 31 Jul 2025 00:23:50 +0000 (00:23 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Wed, 30 Jul 2025 00:21:18 +0000 (00:21 +0000)] 
Daily bump.

3 months agox86: Enable *mov<mode>_(and|or) only for -Oz
H.J. Lu [Sat, 24 May 2025 23:40:29 +0000 (07:40 +0800)] 
x86: Enable *mov<mode>_(and|or) only for -Oz

commit ef26c151c14a87177d46fd3d725e7f82e040e89f
Author: Roger Sayle <roger@nextmovesoftware.com>
Date:   Thu Dec 23 12:33:07 2021 +0000

    x86: PR target/103773: Fix wrong-code with -Oz from pop to memory.

added "*mov<mode>_and" and extended "*mov<mode>_or" to transform
"mov $0,mem" to the shorter "and $0,mem" and "mov $-1,mem" to the shorter
"or $-1,mem" for -Oz.  But the new pattern:

(define_insn "*mov<mode>_and"
  [(set (match_operand:SWI248 0 "memory_operand" "=m")
    (match_operand:SWI248 1 "const0_operand"))
   (clobber (reg:CC FLAGS_REG))]
  "reload_completed"
  "and{<imodesuffix>}\t{%1, %0|%0, %1}"
  [(set_attr "type" "alu1")
   (set_attr "mode" "<MODE>")
   (set_attr "length_immediate" "1")])

and the extended pattern:

(define_insn "*mov<mode>_or"
  [(set (match_operand:SWI248 0 "nonimmediate_operand" "=rm")
    (match_operand:SWI248 1 "constm1_operand"))
   (clobber (reg:CC FLAGS_REG))]
  "reload_completed"
  "or{<imodesuffix>}\t{%1, %0|%0, %1}"
  [(set_attr "type" "alu1")
   (set_attr "mode" "<MODE>")
   (set_attr "length_immediate" "1")])

aren't guarded for -Oz.  As a result, "and $0,mem" and "or $-1,mem" are
generated without -Oz.

1. Change *mov<mode>_and" to define_insn_and_split and split it to
"mov $0,mem" if not -Oz.
2. Change "*mov<mode>_or" to define_insn_and_split and split it to
"mov $-1,mem" if not -Oz.
3. Don't transform "mov $-1,reg" to "push $-1; pop reg" for -Oz since it
should be transformed to "or $-1,reg".

gcc/

PR target/120427
* config/i386/i386.md (*mov<mode>_and): Changed to
define_insn_and_split.  Split it to "mov $0,mem" if not -Oz.
(*mov<mode>_or): Changed to define_insn_and_split.  Split it
to "mov $-1,mem" if not -Oz.
(peephole2): Don't transform "mov $-1,reg" to "push $-1; pop reg"
for -Oz since it will be transformed to "or $-1,reg".

gcc/testsuite/

PR target/120427
* gcc.target/i386/cold-attribute-4.c: Compile with -Oz.
* gcc.target/i386/pr120427-1.c: New test.
* gcc.target/i386/pr120427-2.c: Likewise.
* gcc.target/i386/pr120427-3.c: Likewise.
* gcc.target/i386/pr120427-4.c: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit 4c80062d7b8c272e2e193b8074a8440dbb4fe588)

3 months agoDaily bump.
GCC Administrator [Tue, 29 Jul 2025 00:20:29 +0000 (00:20 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Mon, 28 Jul 2025 00:19:15 +0000 (00:19 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Sun, 27 Jul 2025 00:18:59 +0000 (00:18 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Sat, 26 Jul 2025 00:20:32 +0000 (00:20 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Fri, 25 Jul 2025 00:21:26 +0000 (00:21 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Thu, 24 Jul 2025 00:21:37 +0000 (00:21 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Wed, 23 Jul 2025 00:22:37 +0000 (00:22 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Tue, 22 Jul 2025 00:21:39 +0000 (00:21 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Mon, 21 Jul 2025 00:20:22 +0000 (00:20 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Sun, 20 Jul 2025 00:22:26 +0000 (00:22 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Sat, 19 Jul 2025 00:22:32 +0000 (00:22 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Fri, 18 Jul 2025 00:20:49 +0000 (00:20 +0000)] 
Daily bump.

3 months agox86-64: Add RDI clobber to 64-bit dynamic TLS patterns
H.J. Lu [Thu, 3 Jul 2025 02:54:39 +0000 (10:54 +0800)] 
x86-64: Add RDI clobber to 64-bit dynamic TLS patterns

*tls_global_dynamic_64_largepic, *tls_local_dynamic_64_<mode> and
*tls_local_dynamic_base_64_largepic use RDI as the __tls_get_addr
argument.  Add RDI clobber to these patterns to show it.

gcc/

PR target/120908
* config/i386/i386.cc (legitimize_tls_address): Pass RDI to
gen_tls_local_dynamic_64.
* config/i386/i386.md (*tls_global_dynamic_64_largepic): Add
RDI clobber and use it to generate LEA.
(*tls_local_dynamic_64_<mode>): Likewise.
(*tls_local_dynamic_base_64_largepic): Likewise.
(@tls_local_dynamic_64_<mode>): Add a clobber.

gcc/testsuite/

PR target/120908
* gcc.target/i386/pr120908.c: New test.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit d8d5e2a8031e74f08f61ccdd727476f97940c5a6)

3 months agox86-64: Add RDI clobber to tls_global_dynamic_64 patterns
H.J. Lu [Tue, 1 Jul 2025 09:17:06 +0000 (17:17 +0800)] 
x86-64: Add RDI clobber to tls_global_dynamic_64 patterns

*tls_global_dynamic_64_<mode> uses RDI as the __tls_get_addr argument.
Add RDI clobber to tls_global_dynamic_64 patterns to show it.

PR target/120908
* config/i386/i386.cc (legitimize_tls_address): Pass RDI to
gen_tls_global_dynamic_64.
* config/i386/i386.md (*tls_global_dynamic_64_<mode>): Add RDI
clobber and use it to generate LEA.
(@tls_global_dynamic_64_<mode>): Add a clobber.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit 7710d513a552f1fa1b7485ec6b318bafaa6d4cd7)

3 months agoDaily bump.
GCC Administrator [Thu, 17 Jul 2025 00:19:54 +0000 (00:19 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Wed, 16 Jul 2025 00:19:24 +0000 (00:19 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Tue, 15 Jul 2025 00:20:49 +0000 (00:20 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Mon, 14 Jul 2025 00:20:04 +0000 (00:20 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Sun, 13 Jul 2025 00:27:40 +0000 (00:27 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Sat, 12 Jul 2025 00:22:25 +0000 (00:22 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Fri, 11 Jul 2025 00:22:30 +0000 (00:22 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Thu, 10 Jul 2025 00:23:29 +0000 (00:23 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Wed, 9 Jul 2025 00:24:15 +0000 (00:24 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Tue, 8 Jul 2025 00:22:58 +0000 (00:22 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Mon, 7 Jul 2025 00:22:09 +0000 (00:22 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Sun, 6 Jul 2025 00:22:36 +0000 (00:22 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Sat, 5 Jul 2025 00:22:25 +0000 (00:22 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Fri, 4 Jul 2025 00:22:03 +0000 (00:22 +0000)] 
Daily bump.

4 months agoc++: Fix a pasto in the PR120471 fix [PR120940]
Jakub Jelinek [Thu, 3 Jul 2025 20:39:39 +0000 (22:39 +0200)] 
c++: Fix a pasto in the PR120471 fix [PR120940]

No idea how this slipped in, I'm terribly sorry.
Strangely nothing in the testsuite has caught this, so I've added
a new test for that.

2025-07-03  Jakub Jelinek  <jakub@redhat.com>

PR c++/120940
* typeck.cc (cp_build_array_ref): Fix a pasto.

* g++.dg/parse/pr120940.C: New test.
* g++.dg/warn/Wduplicated-branches9.C: New test.

(cherry picked from commit dc90649466a54ab61926d88500a05f59a55cb055)

4 months agoada: Fix missing error on too large Component_Size not multiple of storage unit
Eric Botcazou [Thu, 1 May 2025 23:30:56 +0000 (01:30 +0200)] 
ada: Fix missing error on too large Component_Size not multiple of storage unit

This is a small regression introduced a few years ago.

gcc/ada/ChangeLog:

* gcc-interface/decl.cc (gnat_to_gnu_component_type): Validate the
Component_Size like the size of a type only if the component type
is actually packed.

4 months agoc++: Fix up cp_build_array_ref COND_EXPR handling [PR120471]
Jakub Jelinek [Tue, 1 Jul 2025 13:28:10 +0000 (15:28 +0200)] 
c++: Fix up cp_build_array_ref COND_EXPR handling [PR120471]

The following testcase is miscompiled since the introduction of UBSan,
cp_build_array_ref COND_EXPR handling replaces
(cond ? a : b)[idx] with cond ? a[idx] : b[idx], but if there are
SAVE_EXPRs inside of idx, they will be evaluated just in one of the
branches and the other uses uninitialized temporaries.

Fixed by keeping doing what it did if idx doesn't have side effects
and is invariant.  Otherwise if op1/op2 are ARRAY_TYPE arrays with
invariant addresses or pointers with invariant values, use
SAVE_EXPR <op0>, SAVE_EXPR <idx>, SAVE_EXPR <op0> as a new condition
and SAVE_EXPR <idx> instead of idx for the recursive calls.
Otherwise punt, but if op1/op2 are ARRAY_TYPE, furthermore call
cp_default_conversion on array, so that COND_EXPR with ARRAY_TYPE doesn't
survive in the IL until expansion.

2025-07-01  Jakub Jelinek  <jakub@redhat.com>

PR c++/120471
gcc/cp/
* typeck.cc (cp_build_array_ref) <case COND_EXPR>: If idx is not
INTEGER_CST, don't optimize the case (but cp_default_conversion on
array early if it has ARRAY_TYPE) or use
SAVE_EXPR <op0>, SAVE_EXPR <idx>, SAVE_EXPR <op0> as new op0 depending
on flag_strong_eval_order and whether op1 and op2 are arrays with
invariant address or tree invariant pointers.  Formatting fixes.
gcc/testsuite/
* g++.dg/ubsan/pr120471.C: New test.
* g++.dg/parse/pr120471.C: New test.

(cherry picked from commit 988e87b66882875b14a6cab11c17516863c74a63)

4 months agoDaily bump.
GCC Administrator [Thu, 3 Jul 2025 00:21:25 +0000 (00:21 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Wed, 2 Jul 2025 00:22:26 +0000 (00:22 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Tue, 1 Jul 2025 00:22:46 +0000 (00:22 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Mon, 30 Jun 2025 00:22:09 +0000 (00:22 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Sun, 29 Jun 2025 00:22:06 +0000 (00:22 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Sat, 28 Jun 2025 00:24:56 +0000 (00:24 +0000)] 
Daily bump.

4 months agoFix misoptimization of CONSTRUCTOR with reverse SSO
Eric Botcazou [Fri, 27 Jun 2025 21:47:49 +0000 (23:47 +0200)] 
Fix misoptimization of CONSTRUCTOR with reverse SSO

fold_ctor_reference already punts on a CONSTRUCTOR whose type has reverse
storage order, but it can be invoked in a couple of places on a CONSTRUCTOR
with native storage order that has been wrapped in a VIEW_CONVERT_EXPR to a
type with reverse storage order; this would require a post adjustment that
does not currently exist, thus yield wrong code for this admittedly quite
pathological (but supported) case.

gcc/
* gimple-fold.cc (fold_const_aggregate_ref_1) <COMPONENT_REF>:
Bail out immediately if the reference has reverse storage order.
* tree-ssa-sccvn.cc (fully_constant_vn_reference_p): Likewise.
gcc/testsuite/
* gnat.dg/sso20.adb: New test.

4 months agoDaily bump.
GCC Administrator [Fri, 27 Jun 2025 00:23:47 +0000 (00:23 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Thu, 26 Jun 2025 00:23:21 +0000 (00:23 +0000)] 
Daily bump.

4 months agoi386: Remove CLDEMOTE for clients
Haochen Jiang [Tue, 17 Jun 2025 06:08:38 +0000 (14:08 +0800)] 
i386: Remove CLDEMOTE for clients

CLDEMOTE is not enabled on clients according to SDM. SDM only mentioned
it will be enabled on Xeon and Atom servers, not clients. Remove them
since Alder Lake (where it is introduced).

gcc/ChangeLog:

* config/i386/i386.h (PTA_ALDERLAKE): Use PTA_GOLDMONT_PLUS
as base to remove PTA_CLDEMOTE.
(PTA_SIERRAFOREST): Add PTA_CLDEMOTE since PTA_ALDERLAKE
does not include that anymore.
* doc/invoke.texi: Update texi file.

4 months agoDaily bump.
GCC Administrator [Wed, 25 Jun 2025 00:22:49 +0000 (00:22 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Tue, 24 Jun 2025 00:22:00 +0000 (00:22 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Mon, 23 Jun 2025 00:21:52 +0000 (00:21 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Sun, 22 Jun 2025 00:21:42 +0000 (00:21 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Sat, 21 Jun 2025 00:21:37 +0000 (00:21 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Fri, 20 Jun 2025 00:24:25 +0000 (00:24 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Thu, 19 Jun 2025 00:24:50 +0000 (00:24 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Wed, 18 Jun 2025 00:25:03 +0000 (00:25 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Tue, 17 Jun 2025 00:23:16 +0000 (00:23 +0000)] 
Daily bump.