]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
6 hours agox86: Transform to "pushq $-1; popq reg" for -Oz releases/gcc-13
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)

7 hours 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)

7 hours 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)

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

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

2 days 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)

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

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

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

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

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

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

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

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

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

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

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

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

13 days 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)

13 days 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)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

3 weeks 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)

3 weeks 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 weeks 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 weeks agoDaily bump.
GCC Administrator [Thu, 3 Jul 2025 00:21:25 +0000 (00:21 +0000)] 
Daily bump.

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

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

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

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

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

4 weeks 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 weeks agoDaily bump.
GCC Administrator [Fri, 27 Jun 2025 00:23:47 +0000 (00:23 +0000)] 
Daily bump.

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

5 weeks 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.

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

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

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

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

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

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

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

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

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

6 weeks agoDaily bump.
GCC Administrator [Mon, 16 Jun 2025 00:21:51 +0000 (00:21 +0000)] 
Daily bump.

6 weeks agoDaily bump.
GCC Administrator [Sun, 15 Jun 2025 00:21:25 +0000 (00:21 +0000)] 
Daily bump.

6 weeks agoDaily bump.
GCC Administrator [Sat, 14 Jun 2025 00:22:56 +0000 (00:22 +0000)] 
Daily bump.

6 weeks agoFix test case for PR117811 which failed for int < 32 bit.
Georg-Johann Lay [Thu, 12 Jun 2025 08:07:37 +0000 (10:07 +0200)] 
Fix test case for PR117811 which failed for int < 32 bit.

PR middle-end/117811
PR testsuite/52641
gcc/testsuite/
* gcc.dg/torture/pr117811.c: Fix for int < 32 bit.

(cherry picked from commit 07f229c2d7ee6b604e5a86092e675d5d36c1ba4e)

6 weeks agoopcodes: fix wrong code in expand_binop_directly [PR117811]
Richard Earnshaw [Thu, 20 Mar 2025 14:42:59 +0000 (14:42 +0000)] 
opcodes: fix wrong code in expand_binop_directly [PR117811]

If expand_binop_directly fails to add a REG_EQUAL note it tries to
unwind and restart.  But it can unwind too far if expand_binop changed
some of the operands before calling it.  We don't need to unwind that
far anyway since we should end up taking exactly the same route next
time, just without a target rtx.

To fix this we remove LAST from the argument list and let the callers
(all in expand_binop) do their own unwinding if the call fails.
Instead we unwind just as far as the entry to expand_binop_directly
and recurse within this function instead of all the way back up.

gcc/ChangeLog:

PR middle-end/117811
* optabs.cc (expand_binop_directly): Remove LAST as an argument,
instead record the last insn on entry.  Only delete insns if
we need to restart and restart by calling ourself, not expand_binop.
(expand_binop): Update callers to expand_binop_directly.  If it
fails to expand the operation, delete back to LAST.

gcc/testsuite:

PR middle-end/117811
* gcc.dg/torture/pr117811.c: New test.

(cherry picked from commit 7679b826840c58343d72d05922355b646db4bdcc)

6 weeks agoDaily bump.
GCC Administrator [Fri, 13 Jun 2025 00:21:33 +0000 (00:21 +0000)] 
Daily bump.

7 weeks agoDaily bump.
GCC Administrator [Thu, 12 Jun 2025 00:22:42 +0000 (00:22 +0000)] 
Daily bump.

7 weeks agolibstdc++: Make system_clock::to_time_t always_inline [PR99832]
Jonathan Wakely [Wed, 28 May 2025 14:19:18 +0000 (15:19 +0100)] 
libstdc++: Make system_clock::to_time_t always_inline [PR99832]

For some 32-bit targets Glibc supports changing the size of time_t to be
64 bits by defining _TIME_BITS=64. That causes an ABI change which
would affect std::chrono::system_clock::to_time_t. Because to_time_t is
not a function template, its mangled name does not depend on the return
type, so it has the same mangled name whether it returns a 32-bit time_t
or a 64-bit time_t. On targets where the size of time_t can be selected
at preprocessing time, that can cause ODR violations, e.g. the linker
selects a definition of to_time_t that returns a 32-bit value but a
caller expects 64-bit and so reads 32 bits of garbage from the stack.

This commit adds always_inline to to_time_t so that all callers inline
the conversion to time_t, and will do so using whatever type time_t
happens to be in that translation unit.

Existing objects compiled before this change will either have inlined
the function anyway (which is likely if compiled with any optimization
enabled) or will contain a COMDAT definition of the inline function and
so still be able to find it at link-time.

The attribute is also added to system_clock::from_time_t, because that's
an equally simple function and it seems reasonable for them to both be
always inlined.

libstdc++-v3/ChangeLog:

PR libstdc++/99832
* include/bits/chrono.h (system_clock::to_time_t): Add
always_inline attribute to be agnostic to the underlying type of
time_t.
(system_clock::from_time_t): Add always_inline for consistency
with to_time_t.
* testsuite/20_util/system_clock/99832.cc: New test.

(cherry picked from commit d045eb13b0b42870a1f081895df3901112a358f0)

7 weeks agolibstdc++: Fix std::format thousands separators when sign present [PR120548]
Jonathan Wakely [Wed, 4 Jun 2025 17:22:28 +0000 (18:22 +0100)] 
libstdc++: Fix std::format thousands separators when sign present [PR120548]

The leading sign character should be skipped when deciding whether to
insert thousands separators into a floating-point format.

libstdc++-v3/ChangeLog:

PR libstdc++/120548
* include/std/format (__formatter_fp::_M_localize): Do not
include a leading sign character in the string to be grouped.
* testsuite/std/format/functions/format.cc: Check grouping when
sign is present in the output.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
(cherry picked from commit 2c3559839d70df6311da18fd93237050405580c3)

7 weeks agolibstdc++: Tweak localized formatting for floating-point types
Jonathan Wakely [Mon, 29 Apr 2024 17:16:29 +0000 (18:16 +0100)] 
libstdc++: Tweak localized formatting for floating-point types

libstdc++-v3/ChangeLog:

* include/std/format (__formatter_fp::_M_localize): Add comments
and micro-optimize string copy.

(cherry picked from commit 99b8be43d7c548db127ee4f4d0918c55edc68b3f)

7 weeks agoDaily bump.
GCC Administrator [Wed, 11 Jun 2025 00:22:11 +0000 (00:22 +0000)] 
Daily bump.

7 weeks agolibstdc++: Fix incorrect links to archived SGI STL docs
Jonathan Wakely [Tue, 20 May 2025 09:53:41 +0000 (10:53 +0100)] 
libstdc++: Fix incorrect links to archived SGI STL docs

In r8-7777-g25949ee33201f2 I updated some URLs to point to copies of the
SGI STL docs in the Wayback Machine, because the original pags were no
longer hosted on sgi.com. However, I incorrectly assumed that if one
archived page was at https://web.archive.org/web/20171225062613/... then
all the other pages would be too. Apparently that's not how the Wayback
Machine works, and each page is archived on a different date. That meant
that some of our links were redirecting to archived copies of the
announcement that the SGI STL docs have gone away.

This fixes each URL to refer to a correctly archived copy of the
original docs.

libstdc++-v3/ChangeLog:

* doc/xml/faq.xml: Update URL for archived SGI STL docs.
* doc/xml/manual/containers.xml: Likewise.
* doc/xml/manual/extensions.xml: Likewise.
* doc/xml/manual/using.xml: Likewise.
* doc/xml/manual/utilities.xml: Likewise.
* doc/html/*: Regenerate.

(cherry picked from commit 501e6e786652748ff0ad9a322f74b9b47970031f)

7 weeks agoDaily bump.
GCC Administrator [Tue, 10 Jun 2025 00:21:51 +0000 (00:21 +0000)] 
Daily bump.

7 weeks agoDaily bump.
GCC Administrator [Mon, 9 Jun 2025 00:21:25 +0000 (00:21 +0000)] 
Daily bump.

7 weeks agoDaily bump.
GCC Administrator [Sun, 8 Jun 2025 00:20:43 +0000 (00:20 +0000)] 
Daily bump.

7 weeks agoDaily bump.
GCC Administrator [Sat, 7 Jun 2025 00:21:58 +0000 (00:21 +0000)] 
Daily bump.

7 weeks agolibstdc++: fix a dangling reference crash in ranges::is_permutation [PR118160]
Giuseppe D'Angelo [Thu, 6 Feb 2025 14:24:17 +0000 (14:24 +0000)] 
libstdc++: fix a dangling reference crash in ranges::is_permutation [PR118160]

The code was caching the result of `invoke(proj, *it)` in a local
`auto &&` variable. The problem is that this may create dangling
references, for instance in case `proj` is `std::identity` (the common
case) and `*it` produces a prvalue: lifetime extension does not
apply here due to the expressions involved.

Instead, store (and lifetime-extend) the result of `*it` in a separate
variable, then project that variable. While at it, also forward the
result of the projection to the predicate, so that the predicate can
act on the proper value category.

libstdc++-v3/ChangeLog:

PR libstdc++/118160
PR libstdc++/100249
* include/bits/ranges_algo.h (__is_permutation_fn): Avoid a
dangling reference by storing the result of the iterator
dereference and the result of the projection in two distinct
variables, in order to lifetime-extend each one.
Forward the projected value to the predicate.
* testsuite/25_algorithms/is_permutation/constrained.cc: Add a
test with a range returning prvalues. Test it in a constexpr
context, in order to rely on the compiler to catch UB.

Signed-off-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 2a2bd96d0d2109384a0eedde843ba811d2e18738)

7 weeks agoDaily bump.
GCC Administrator [Fri, 6 Jun 2025 00:22:10 +0000 (00:22 +0000)] 
Daily bump.

7 weeks agoc++: lambda this capture and requires [PR120123]
Jason Merrill [Fri, 30 May 2025 22:27:45 +0000 (18:27 -0400)] 
c++: lambda this capture and requires [PR120123]

We shouldn't need to be within the lambda body to look through it to the
enclosing non-static member function.

This change is a small subset of r16-970.

PR c++/120123

gcc/cp/ChangeLog:

* lambda.cc (nonlambda_method_basetype): Look through lambdas
even when current_class_ref is null.

gcc/testsuite/ChangeLog:

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

7 weeks agolibstdc++: fix compile error when converting std::weak_ptr<T[]>
Giuseppe D'Angelo [Mon, 9 Dec 2024 23:56:13 +0000 (00:56 +0100)] 
libstdc++: fix compile error when converting std::weak_ptr<T[]>

A std::weak_ptr<T[]> can be converted to a compatible
std::weak_ptr<U[]>. This is implemented by having suitable converting
constructors to std::weak_ptr which dispatch to the __weak_ptr base
class (implementation detail).

In __weak_ptr<T[]>, lock() is supposed to return a __shared_ptr<T[]>,
not a __shared_ptr<element_type> (that is, __shared_ptr<T>).

Unfortunately the return type of lock() and the type of the returned
__shared_ptr were mismatching and that was causing a compile error: when
converting a __weak_ptr<T[]> to a __weak_ptr<U[]> through __weak_ptr's
converting constructor, the code calls lock(), and that simply fails to
build.

Fix it by removing the usage of element_type inside lock(), and using
_Tp instead.

Note that std::weak_ptr::lock() itself was already correct; the one in
__weak_ptr was faulty (and that is the one called by __weak_ptr's
converting constructors).

libstdc++-v3/ChangeLog:

* include/bits/shared_ptr_base.h (lock): Fixed a compile error
when calling lock() on a weak_ptr<T[]>, by removing an
erroneous usage of element_type from within lock().
* testsuite/20_util/shared_ptr/requirements/explicit_instantiation/1.cc:
Add more tests for array types.
* testsuite/20_util/weak_ptr/requirements/explicit_instantiation/1.cc:
Likewise.
* testsuite/20_util/shared_ptr/requirements/1.cc: New test.
* testsuite/20_util/weak_ptr/requirements/1.cc: New test.

(cherry picked from commit df0e6509bf74421ea68a2e025300bcd6ca63722f)

7 weeks agoFix crash with constant initializer caused by IPA
Eric Botcazou [Thu, 5 Jun 2025 11:20:26 +0000 (13:20 +0200)] 
Fix crash with constant initializer caused by IPA

The testcase compiled with -O2 -gnatn makes the compiler crash in
vect_can_force_dr_alignment_p during SLP vectorization:

  if (decl_in_symtab_p (decl)
      && !symtab_node::get (decl)->can_increase_alignment_p ())
    return false;

because symtab_node::get (decl) returns a null node.  The phenomenon occurs
for a pair of twin symbols listed like so in .cgraph:

Opt7_Pkg.T12b/17 (Opt7_Pkg.T12b)
  Type: variable definition analyzed
  Visibility: semantic_interposition external public artificial
  Aux: @0x44d45e0
  References:
  Referring: opt7_pkg__enum_name_table/13 (addr) opt7_pkg__enum_name_table/13
(addr)
  Availability: not-ready
  Varpool flags: initialized read-only const-value-known

Opt7_Pkg.T8b/16 (Opt7_Pkg.T8b)
  Type: variable definition analyzed
  Visibility: semantic_interposition external public artificial
  Aux: @0x7f9fda3fff00
  References:
  Referring: opt7_pkg__enum_name_table/13 (addr) opt7_pkg__enum_name_table/13
(addr)
  Availability: not-ready
  Varpool flags: initialized read-only const-value-known

with:

opt7_pkg__enum_name_table/13 (Opt7_Pkg.Enum_Name_Table)
  Type: variable definition analyzed
  Visibility: semantic_interposition external public
  Aux: @0x44d45e0
  References: Opt7_Pkg.T8b/16 (addr) Opt7_Pkg.T8b/16 (addr) Opt7_Pkg.T12b/17
(addr) Opt7_Pkg.T12b/17 (addr)
  Referring: opt7_pkg__image/2 (read) opt7_pkg__image/2 (read)
opt7_pkg__image/2 (read) opt7_pkg__image/2 (read) opt7_pkg__image/2 (read)
opt7_pkg__image/2 (read) opt7_pkg__image/2 (read) opt7_pkg__image/2 (read)
  Availability: not-ready
  Varpool flags: initialized read-only const-value-known

being the crux of the matter.

What happens is that symtab_remove_unreachable_nodes leaves the last symbol
in kind of a limbo state: in .remove_symbols, we have:

opt7_pkg__enum_name_table/13 (Opt7_Pkg.Enum_Name_Table)
  Type: variable
  Body removed by symtab_remove_unreachable_nodes
  Visibility: externally_visible semantic_interposition external public
  References:
  Referring: opt7_pkg__image/2 (read) opt7_pkg__image/2 (read)
  Availability: not_available
  Varpool flags: initialized read-only const-value-known

This means that the "body" (DECL_INITIAL) of the symbol has been disregarded
during reachability analysis, causing the first two symbols to be discarded:

Reclaiming variables: Opt7_Pkg.T12b/17 Opt7_Pkg.T8b/16

but the DECL_INITIAL is explicitly preserved for later constant folding,
which makes it possible to retrofit the DECLs corresponding to the first
two symbols in the GIMPLE IR and ultimately leads to the crash.

gcc/
* tree-vect-data-refs.cc (vect_can_force_dr_alignment_p): Return
false if the variable has no symtab node.

gcc/testsuite/
* gnat.dg/specs/opt7.ads: New test.
* gnat.dg/specs/opt7_pkg.ads: New helper.
* gnat.dg/specs/opt7_pkg.adb: Likewise.

7 weeks agoBump BASE-VER.
Jakub Jelinek [Thu, 5 Jun 2025 16:50:16 +0000 (18:50 +0200)] 
Bump BASE-VER.

2025-06-05  Jakub Jelinek  <jakub@redhat.com>

* BASE-VER: Set to 13.4.1.

7 weeks agoUpdate ChangeLog and version files for release releases/gcc-13.4.0
Jakub Jelinek [Thu, 5 Jun 2025 16:03:58 +0000 (16:03 +0000)] 
Update ChangeLog and version files for release

8 weeks agoDaily bump.
GCC Administrator [Thu, 5 Jun 2025 00:23:07 +0000 (00:23 +0000)] 
Daily bump.

8 weeks agoDaily bump.
GCC Administrator [Wed, 4 Jun 2025 00:22:59 +0000 (00:22 +0000)] 
Daily bump.

8 weeks agoDaily bump.
GCC Administrator [Tue, 3 Jun 2025 00:20:59 +0000 (00:20 +0000)] 
Daily bump.

8 weeks agoFortran: Suppress failing part of testcase [PR109345]
Paul Thomas [Mon, 2 Jun 2025 08:50:01 +0000 (09:50 +0100)] 
Fortran: Suppress failing part of testcase [PR109345]

2024-06-02  Paul Thomas  <pault@gcc.gnu.org>

gcc/testsuite/
PR fortran/109345
* gfortran.dg/pr109345.f90: Comment out test of component refs.

8 weeks agoFortran: Fix gimplification error on assignment to pointer [PR103391]
Andre Vehreschild [Tue, 4 Mar 2025 11:56:20 +0000 (12:56 +0100)] 
Fortran: Fix gimplification error on assignment to pointer [PR103391]

PR fortran/103391

gcc/fortran/ChangeLog:

* trans-expr.cc (gfc_trans_assignment_1): Do not use poly assign
for pointer arrays on lhs (as it is done for allocatables
already).

gcc/testsuite/ChangeLog:

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

(cherry picked from commit 04909c7ecc023874c3444b85f88c60b7b7cc7778)

8 weeks agoDaily bump.
GCC Administrator [Mon, 2 Jun 2025 00:20:13 +0000 (00:20 +0000)] 
Daily bump.

8 weeks agoDaily bump.
GCC Administrator [Sun, 1 Jun 2025 00:21:40 +0000 (00:21 +0000)] 
Daily bump.

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

2 months agotestsuite: Add testcase for GCC 13 branch s390 bug [PR120480]
Jakub Jelinek [Fri, 30 May 2025 12:35:12 +0000 (14:35 +0200)] 
testsuite: Add testcase for GCC 13 branch s390 bug [PR120480]

This got broken with r13-9727 and fixed with either of
r13-9729 or r13-9728.

2025-05-30  Jakub Jelinek  <jakub@redhat.com>

PR target/120480
* gcc.dg/pr120480.c: New test.

(cherry picked from commit c13d5b939fee565047394475952878dc5394fb74)

2 months agos390: Use match_scratch instead of scratch in define_split [PR119834]
Jakub Jelinek [Thu, 17 Apr 2025 08:57:18 +0000 (10:57 +0200)] 
s390: Use match_scratch instead of scratch in define_split [PR119834]

The following testcase ICEs since r15-1579 (addition of late combiner),
because *clrmem_short can't be split.
The problem is that the define_insn uses
   (use (match_operand 1 "nonmemory_operand" "n,a,a,a"))
   (use (match_operand 2 "immediate_operand" "X,R,X,X"))
   (clobber (match_scratch:P 3 "=X,X,X,&a"))
and define_split assumed that if operands[1] is const_int_operand,
match_scratch will be always scratch, and it will be reg only if
it was the last alternative where operands[1] is a reg.
The pattern doesn't guarantee it though, of course RA will not try to
uselessly assign a reg there if it is not needed, but during RA
on the testcase below we match the last alternative, but then comes
late combiner and propagates const_int 3 into operands[1].  And that
matches fine, match_scratch matches either scratch or reg and the constraint
in that case is X for the first variant, so still just fine.  But we won't
split that because the splitters only expect scratch.

The following patch fixes it by using match_scratch instead of scratch,
so that it accepts either.

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

PR target/119834
* config/s390/s390.md (define_split after *cpymem_short): Use
(clobber (match_scratch N)) instead of (clobber (scratch)).  Use
(match_dup 4) and operands[4] instead of (match_dup 3) and operands[3]
in the last of those.
(define_split after *clrmem_short): Use (clobber (match_scratch N))
instead of (clobber (scratch)).
(define_split after *cmpmem_short): Likewise.

* g++.target/s390/pr119834.C: New test.

(cherry picked from commit 22fe83d6fc9f59311241c981bcad58b61e2056d4)

2 months agoRevert "[LRA]: Backporting solutions for PR112918 and PR113354 to solve PR99015"
Vladimir N. Makarov [Fri, 30 May 2025 12:28:59 +0000 (08:28 -0400)] 
Revert "[LRA]: Backporting solutions for PR112918 and PR113354 to solve PR99015"

This reverts commit af73c8bf5168848275bf909ee44fbb8f4973438f.

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

2 months ago[LRA]: Backporting solutions for PR112918 and PR113354 to solve PR99015
Vladimir N. Makarov [Thu, 29 May 2025 19:26:30 +0000 (15:26 -0400)] 
[LRA]: Backporting solutions for PR112918 and PR113354 to solve PR99015

Patches for PR112918 and PR11354 depend on each other and can not be
clearly applied to gcc-13 branch.  So patches were modified and
combined.

gcc/ChangeLog:

PR rtl-optimization/99015
* lra-constraints.cc (enough_allocatable_hard_regs_p): Extract
from in_class_p.
(in_class_p): Use it with added conditions.
(process_alt_operands): Try to change class too.
(curr_insn_transform): Pass true to in_class_p for reg operand
win.  Spill pseudo only used in the insn if the corresponding
operand does not require hard register anymore.

2 months agoDaily bump.
GCC Administrator [Thu, 29 May 2025 00:20:49 +0000 (00:20 +0000)] 
Daily bump.

2 months agotree-sra: Do not create stores into const aggregates (PR111873)
Martin Jambor [Wed, 14 May 2025 10:08:24 +0000 (12:08 +0200)] 
tree-sra: Do not create stores into const aggregates (PR111873)

This patch fixes (hopefully the) one remaining place where gimple SRA
was still creating a load into const aggregates.  It occurs when there
is a replacement for a load but that replacement is not type
compatible - typically because it is a single field structure.

I have used testcases from duplicates because the original test-case
no longer reproduces for me.

gcc/ChangeLog:

2025-05-13  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/111873
* tree-sra.cc (sra_modify_expr): When processing a load which has
a type-incompatible replacement, do not store the contents of the
replacement into the original aggregate when that aggregate is
const.

gcc/testsuite/ChangeLog:

2025-05-13  Martin Jambor  <mjambor@suse.cz>

* gcc.dg/ipa/pr120044-1.c: New test.
* gcc.dg/ipa/pr120044-2.c: Likewise.
* gcc.dg/tree-ssa/pr114864.c: Likewise.

(cherry picked from commit 9d039eff453f777c58642ff16178c1ce2a4be6ab)

2 months agoconfigure, Darwin: Recognise new naming for Xcode ld.
Iain Sandoe [Tue, 15 Apr 2025 13:02:21 +0000 (14:02 +0100)] 
configure, Darwin: Recognise new naming for Xcode ld.

The latest editions of XCode have altered the identify reported by 'ld -v'
(again).  This means that GCC configure no longer detects the version.

Fixed by adding the new name to the set checked.

gcc/ChangeLog:

* configure: Regenerate.
* configure.ac: Recognise PROJECT:ld-mmmm.nn.aa as an identifier
for Darwin's static linker.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
(cherry picked from commit 7f56a8e8ad1c33d358e9e09fcbaf263c2caba1b9)

2 months agotestsuite, gm2: Use -B option for libstdc++ where required.
Iain Sandoe [Mon, 10 Mar 2025 08:44:41 +0000 (08:44 +0000)] 
testsuite, gm2: Use -B option for libstdc++ where required.

We need to add testsuite  options to locate gm2 libs and libstdc++.

Usually '-L' options are added to point to the relevant directories for
the uninstalled libraries.

In cases where libraries are available as both shared and convenience some
additional checks are made.

For some targets -static-xxxx options are handled by specs substitution and
need a '-B' option rather than '-L'.  For Darwin, when embedded runpaths are
in use (the default for all versions after macOS 10.11), '-B' is also needed
to provide the runpath.

When '-B' is used, this results in a '-L' for each path that exists (so that
appending a '-L' as well is a needless duplicate).  There are also cases
where tools warn for duplicates, leading to spurious fails.

Therefore the objective of the code here is to add just one '-L' or '-B' for
each of the libraries.

Currently, we are forcing the full paths to each of the gm2 convenience libs
onto the link line and therefore the B/L logic is not needed there.  It would
need to be added if/when gm2 is tested with shared libraries

gcc/testsuite/ChangeLog:

* lib/gm2.exp: Arrange for a '-B' option to be added for the
libstdc++ paths on targets that need it.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
(cherry picked from commit 6b9ceac9e4e2be304c39e6bc8744edf21faac4fb)

2 months agoDarwin: Pass -macos_version_min to the linker [PR119172].
Iain Sandoe [Sun, 9 Mar 2025 09:24:34 +0000 (09:24 +0000)] 
Darwin: Pass -macos_version_min to the linker [PR119172].

For binaries to be notarised, the SDK version must be available.
Since we do not, at present, parse this information we have been
passing "0.0" to ld64.  This now results in a warning and a fail
to notarise.  As a quick-fix, we can fall back to letting ld64
figure out the SDK version (which it does for -macos_version_min).

TODO: Parse the SDKSetting.plist at some point.

cherry-picked from 952e17223d3a9 and fc728cfd569e291a5

PR target/119172

gcc/ChangeLog:

* config.in: Regenerate.
* config/darwin.h (DARWIN_PLATFORM_ID): Add the option to
use -macos_version_min where available.
* configure: Regenerate.
* configure.ac: Check for ld64 support of -macos_version_min.

Co-authored-by: Andrew Pinski <quic_apinski@quicinc.com>
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2 months agofixincludes: adjust stdio fix for macOS 15 headers
Francois-Xavier Coudert [Thu, 27 Jun 2024 16:55:22 +0000 (18:55 +0200)] 
fixincludes: adjust stdio fix for macOS 15 headers

fixincludes/ChangeLog:

* fixincl.x: Regenerate.
* inclhack.def (apple_local_stdio_fn_deprecation): Also apply to
_stdio.h.

(cherry picked from commit 1dc143181550573c9c902fb7a3b495e9b409d0b0)

2 months agolibgcc, Darwin: Drop the legacy library build for macOS >= 10.12 [PR116809].
Mark Mentovai [Tue, 24 Sep 2024 20:11:14 +0000 (16:11 -0400)] 
libgcc, Darwin: Drop the legacy library build for macOS >= 10.12 [PR116809].

From macOSX15 SDK,  the unwinder no longer exports some of the symbols used
in that library which (a) causes bootstrap fail and (b) means that the
legacy library is no longer useful.

No open branch of GCC emits references to this library - and any already
-built code that depends on the symbols would need rework anyway.

We have been asked to extend this back to the earliest OS vesion supported
by the SDK (10.12).

PR target/116809

libgcc/ChangeLog:

* config.host: Build legacy libgcc_s.1 on hosts before macOS 10.12.
* config/i386/t-darwin: Remove reference to legacy libgcc_s.1
* config/rs6000/t-darwin: Likewise.
* config/t-darwin-libgccs1: New file.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
(cherry picked from commit d9cafa0c4f0a81304d9b95a78ccc8e9003c6d7a3)

2 months agos390x: Fix vec_xl/vec_xst type aliasing [PR114676]
Andreas Krebbel [Tue, 23 Apr 2024 08:05:46 +0000 (10:05 +0200)] 
s390x: Fix vec_xl/vec_xst type aliasing [PR114676]

The requirements of the vec_xl/vec_xst intrinsincs wrt aliasing of the
pointer argument are not really documented.  As it turns out, users
are likely to get it wrong.  With this patch we let the pointer
argument alias everything in order to make it more robust for users.

gcc/ChangeLog:

PR target/114676
* config/s390/s390-c.cc (s390_expand_overloaded_builtin): Use a
MEM_REF with an addend of type ptr_type_node.

gcc/testsuite/ChangeLog:

PR target/114676
* gcc.target/s390/zvector/pr114676.c: New test.

Suggested-by: Jakub Jelinek <jakub@redhat.com>
(cherry picked from commit 42189f21b22c43ac8ab46edf5f6a7b4d99bc86a5)