]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
3 months agolibstdc++: Document thread-safety for COW std::string [PR21334]
Jonathan Wakely [Fri, 11 Apr 2025 10:08:34 +0000 (11:08 +0100)] 
libstdc++: Document thread-safety for COW std::string [PR21334]

The gcc4-compatible copy-on-write std::string does not conform to the
C++11 requirements on data race avoidance in standard containers.
Specifically, calling non-const member functions such as begin() and
data() needs to do the "copy on write" operation and so is most
definitely a modification of the object. As such, those non-const
members must not be called concurrently with any other uses of the
string object.

libstdc++-v3/ChangeLog:

PR libstdc++/21334
* doc/xml/manual/using.xml: Document that container data race
avoidance rules do not apply to COW std::string.
* doc/html/*: Regenerate.

(cherry picked from commit dd35f66287b7cca196a720c9641e463255dceb1c)

3 months agoDaily bump.
GCC Administrator [Tue, 15 Apr 2025 00:21:18 +0000 (00:21 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Mon, 14 Apr 2025 00:19:22 +0000 (00:19 +0000)] 
Daily bump.

3 months agortl-optimization/119689 - compare-debug failure with LRA
Richard Biener [Wed, 9 Apr 2025 12:36:19 +0000 (14:36 +0200)] 
rtl-optimization/119689 - compare-debug failure with LRA

The previous change to fix LRA rematerialization broke compare-debug
for i586 bootstrap.  Fixed by using prev_nonnote_nondebug_insn
instead of prev_nonnote_insn.

PR rtl-optimization/119689
PR rtl-optimization/115568
* lra-remat.cc (create_cands): Use prev_nonnote_nondebug_insn
to check whether insn2 is directly before insn.

* g++.target/i386/pr119689.C: New testcase.

(cherry picked from commit 088887de7717a22b1503760e9b79dfbe22a0f428)

3 months ago[PR115568][LRA]: Use more strict output reload check in rematerialization
Vladimir N. Makarov [Wed, 5 Feb 2025 19:23:23 +0000 (14:23 -0500)] 
[PR115568][LRA]: Use more strict output reload check in rematerialization

  In this PR case LRA rematerialized a value from inheritance insn
instead of output reload one.  This resulted in considering a
rematerilization candidate value available when it was actually
not.  As a consequence an insn after rematerliazation used the
unexpected value and this use resulted in fp exception.  The patch
fixes this bug.

gcc/ChangeLog:

PR rtl-optimization/115568
* lra-remat.cc (create_cands): Check that output reload insn is
adjacent to given insn.  Update a comment.

gcc/testsuite/ChangeLog:

PR rtl-optimization/115568
* gcc.target/i386/pr115568.c: New.

(cherry picked from commit 98545441308c2ae4d535f14b108ad6551fd927d5)

3 months agoDaily bump.
GCC Administrator [Sun, 13 Apr 2025 00:18:50 +0000 (00:18 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Sat, 12 Apr 2025 00:18:48 +0000 (00:18 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Fri, 11 Apr 2025 00:18:50 +0000 (00:18 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Thu, 10 Apr 2025 00:19:05 +0000 (00:19 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Wed, 9 Apr 2025 00:19:41 +0000 (00:19 +0000)] 
Daily bump.

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

3 months agoDaily bump.
GCC Administrator [Mon, 7 Apr 2025 00:19:02 +0000 (00:19 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Sun, 6 Apr 2025 00:18:50 +0000 (00:18 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Sat, 5 Apr 2025 00:19:15 +0000 (00:19 +0000)] 
Daily bump.

4 months agotree-optimization/114246 - invalid call argument from DSE
Richard Biener [Wed, 6 Mar 2024 08:02:31 +0000 (09:02 +0100)] 
tree-optimization/114246 - invalid call argument from DSE

The following makes sure to strip type conversions added by
build_fold_addr_expr before placing the result in a call argument.

PR tree-optimization/114246
* tree-ssa-dse.cc (increment_start_addr): Strip useless
type conversions from the adjusted address.

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

(cherry picked from commit 0249744a9fe0775c2c895727aeebec4c59fd5f95)

4 months agomiddle-end/115641 - invalid address construction
Richard Biener [Thu, 18 Jul 2024 11:35:33 +0000 (13:35 +0200)] 
middle-end/115641 - invalid address construction

fold_truth_andor_1 via make_bit_field_ref builds an address of
a CALL_EXPR which isn't valid GENERIC and later causes an ICE.
The following simply avoids the folding for f ().a != 1 || f ().b != 2
as it is a premature optimization anyway.  The alternative would
have been to build a TARGET_EXPR around the call.  To get this far
f () has to be const as otherwise the two calls are not semantically
equivalent for the optimization.

PR middle-end/115641
* fold-const.cc (decode_field_reference): If the inner
reference isn't something we can take the address of, fail.

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

(cherry picked from commit 3670c70c561656a19f6bff36dd229f18120af127)

4 months agotree-optimization/116481 - avoid building function_type[]
Richard Biener [Sun, 13 Oct 2024 09:42:27 +0000 (11:42 +0200)] 
tree-optimization/116481 - avoid building function_type[]

The following avoids building an array type with function or method
element type during diagnosing an array bound violation as this
will result in an error, rejecting a program with a not too useful
error message.  Instead build such array type manually.

PR tree-optimization/116481
* pointer-query.cc (build_printable_array_type):
Build an array types with function or method element type
manually to avoid bogus diagnostic.

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

(cherry picked from commit 1506027347776a2f6ec5b92d56ef192e85944e2e)

4 months agotree-optimization/116850 - corrupt post-dom info
Richard Biener [Thu, 26 Sep 2024 13:41:59 +0000 (15:41 +0200)] 
tree-optimization/116850 - corrupt post-dom info

Path isolation computes post-dominators on demand but can end up
splitting blocks after that, wrecking it.  We can delay splitting
of blocks until we no longer need the post-dom info which is what
the following patch does to solve the issue.

PR tree-optimization/116850
* gimple-ssa-isolate-paths.cc (bb_split_points): New global.
(insert_trap): Delay BB splitting if post-doms are computed.
(find_explicit_erroneous_behavior): Process delayed BB
splitting after releasing post dominators.
(gimple_ssa_isolate_erroneous_paths): Do not free post-dom
info here.

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

(cherry picked from commit 64163657ba7e70347087a63bb2b32d83b52ea7d9)

4 months agotree-optimization/117119 - ICE with int128 IV in dataref analysis
Richard Biener [Mon, 13 Jan 2025 08:12:23 +0000 (09:12 +0100)] 
tree-optimization/117119 - ICE with int128 IV in dataref analysis

Here's another fix for a missing check that an IV value fits in a
HIW.  It's originally from Stefan.

PR tree-optimization/117119
* tree-data-ref.cc (initialize_matrix_A): Check whether
an INTEGER_CST fits in HWI, otherwise return chrec_dont_know.

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

Co-Authored-By: Stefan Schulze Frielinghaus <stefansf@linux.ibm.com>
(cherry picked from commit d3904a3ad9d7b4c8e5e536e5166b89548510fd48)

4 months agotree-optimization/117574 - bougs niter lt-to-ne
Richard Biener [Fri, 15 Nov 2024 10:56:14 +0000 (11:56 +0100)] 
tree-optimization/117574 - bougs niter lt-to-ne

When trying to change a IV from IV0 < IV1 to IV0' != IV1' we apply
fancy adjustments to the may_be_zero condition we compute rather
than using the obvious IV0->base >= IV1->base expression (to be
able to use > instead of >=?).  This doesn't seem to go well.

PR tree-optimization/117574
* tree-ssa-loop-niter.cc (number_of_iterations_lt_to_ne):
Use the obvious may_be_zero condition.

* gcc.dg/torture/pr117574-1.c: New testcase.

(cherry picked from commit ff5a14abeb31cd6bd0ca55e7043d05c8141a8c7f)

4 months agotree-optimization/117912 - bogus address equivalences for __builtin_object_size
Richard Biener [Thu, 5 Dec 2024 09:47:13 +0000 (10:47 +0100)] 
tree-optimization/117912 - bogus address equivalences for __builtin_object_size

VN again is the culprit for exploiting address equivalences before
__builtin_object_size got the chance to do its job.  This time
it isn't about union members but adjacent structure fields where
an address to one after the last element of an array field can
spill over to the next field.

The following protects all out-of-bound accesses on the upper bound
side (singling out TYPE_MAX_VALUE + 1 is more expensive).  It
ignores other out-of-bound addresses that would invoke UB.

Zero-sized arrays are a bit awkward because the C++ represents them
with a -1U upper bound.

There's a similar issue for zero-sized components whose address can
be the same as the adjacent field in C.

PR tree-optimization/117912
* tree-ssa-sccvn.cc (copy_reference_ops_from_ref): For addresses
of zero-sized components do not set ->off if the object size pass
didn't run.
For OOB ARRAY_REF accesses in address expressions avoid setting
->off if the object size pass didn't run.
(valueize_refs_1): Likewise.

* c-c++-common/torture/pr117912-1.c: New testcase.
* c-c++-common/torture/pr117912-2.c: Likewise.
* c-c++-common/torture/pr117912-3.c: Likewise.

(cherry picked from commit 233972ab3b5338d7a5d1d7af9108c1f366170e44)

4 months agotree-optimization/118717 - store commoning vs. abnormals
Richard Biener [Mon, 3 Feb 2025 08:55:50 +0000 (09:55 +0100)] 
tree-optimization/118717 - store commoning vs. abnormals

When we sink common stores in cselim or the sink pass we have to
make sure to not introduce overlapping lifetimes for abnormals
used in the ref.  The easiest is to avoid sinking stmts which
reference abnormals at all which is what the following does.

PR tree-optimization/118717
* tree-ssa-phiopt.cc (cond_if_else_store_replacement_1):
Do not common stores referencing abnormal SSA names.
* tree-ssa-sink.cc (sink_common_stores_to_bb): Likewise.

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

(cherry picked from commit fbcbbfe2bf83eb8b1347144eeca37b06be5a8bb5)

4 months agoAda: Fix thinko in Eigensystem for complex Hermitian matrices
Eric Botcazou [Fri, 4 Apr 2025 09:45:23 +0000 (11:45 +0200)] 
Ada: Fix thinko in Eigensystem for complex Hermitian matrices

The implementation solves the eigensystem for a NxN complex Hermitian matrix
by first solving it for a 2Nx2N real symmetric matrix and then interpreting
the 2Nx1 real vectors as Nx1 complex ones, but the last step does not work.

The patch fixes the last step and also performs a small cleanup throughout
the implementation, mostly in the commentary and without functional changes.

gcc/ada/
* libgnat/a-ngcoar.adb (Eigensystem): Adjust notation and fix the
layout of the real symmetric matrix in the main comment.  Adjust
the layout of the associated code accordingly and correctly turn
the 2Nx1 real vectors into Nx1 complex ones.
(Eigenvalues): Minor similar tweaks.
* libgnat/a-ngrear.adb (Jacobi): Minor tweaks in the main comment.
Adjust notation and corresponding parameter names of functions.
Fix call to Unit_Matrix routine.  Adjust the comment describing
the various kinds of iterations to match the implementation.

4 months agoDaily bump.
GCC Administrator [Fri, 4 Apr 2025 00:19:26 +0000 (00:19 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Thu, 3 Apr 2025 00:20:14 +0000 (00:20 +0000)] 
Daily bump.

4 months agolibstdc++: Teach optimizer that empty COW strings are empty [PR107087]
Jonathan Wakely [Fri, 31 Mar 2023 12:44:04 +0000 (13:44 +0100)] 
libstdc++: Teach optimizer that empty COW strings are empty [PR107087]

The compiler doesn't know about the invariant that the _S_empty_rep()
object is immutable and so _M_length and _M_refcount are always zero.
This means that we get warnings about writing possibly-non-zero length
strings into buffers that can't hold them. If we teach the compiler that
the empty rep is always zero length, it knows it can be copied into any
buffer.

For Stage 1 we might want to also consider adding this to capacity():

if (_S_empty_rep()._M_capacity != 0)
  __builtin_unreachable();

And this to _Rep::_M_is_leaked() and _Rep::_M_is_shared():

  if (_S_empty_rep()._M_refcount != 0)
    __builtin_unreachable();

libstdc++-v3/ChangeLog:

PR tree-optimization/107087
* include/bits/cow_string.h (basic_string::size()): Add
optimizer hint that _S_empty_rep()._M_length is always zero.
(basic_string::length()): Call size().

(cherry picked from commit 4969dcd2b7a94ce6c0d07225b21b5f3c040a4902)

4 months agolibstdc++: Avoid aliasing violation in std::valarray [PR99117]
Jonathan Wakely [Thu, 8 Feb 2024 13:59:42 +0000 (13:59 +0000)] 
libstdc++: Avoid aliasing violation in std::valarray [PR99117]

The call to __valarray_copy constructs an _Array object to refer to
this->_M_data but that means that accesses to this->_M_data are through
a restrict-qualified pointer. This leads to undefined behaviour when
copying from an _Expr object that actually aliases this->_M_data.

Replace the call to __valarray_copy with a plain loop. I think this
removes the only use of that overload of __valarray_copy, so it could
probably be removed. I haven't done that here.

libstdc++-v3/ChangeLog:

PR libstdc++/99117
* include/std/valarray (valarray::operator=(const _Expr&)):
Use loop to copy instead of __valarray_copy with _Array.
* testsuite/26_numerics/valarray/99117.cc: New test.

(cherry picked from commit b58f0e5216a3053486e7f1aa96c3f2443b14d630)

4 months agoDaily bump.
GCC Administrator [Wed, 2 Apr 2025 00:21:11 +0000 (00:21 +0000)] 
Daily bump.

4 months agoaarch64: Use PAUTH instead of V8_3A in some places
Andrew Carlotti [Tue, 30 Jul 2024 15:26:04 +0000 (16:26 +0100)] 
aarch64: Use PAUTH instead of V8_3A in some places

gcc/ChangeLog:

PR target/119372
* config/aarch64/aarch64.cc
(aarch64_expand_epilogue): Use TARGET_PAUTH.
* config/aarch64/aarch64.md: Update comment.

(cherry-picked from commit 20385cb92cbd4a1934661ab97a162c1e25935836)

4 months agoDaily bump.
GCC Administrator [Tue, 1 Apr 2025 00:20:52 +0000 (00:20 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Mon, 31 Mar 2025 00:20:31 +0000 (00:20 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Sun, 30 Mar 2025 00:19:50 +0000 (00:19 +0000)] 
Daily bump.

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

4 months agoDaily bump.
GCC Administrator [Fri, 28 Mar 2025 00:21:02 +0000 (00:21 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Thu, 27 Mar 2025 00:20:08 +0000 (00:20 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Wed, 26 Mar 2025 00:18:57 +0000 (00:18 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Tue, 25 Mar 2025 00:20:53 +0000 (00:20 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Mon, 24 Mar 2025 00:19:41 +0000 (00:19 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Sun, 23 Mar 2025 00:18:55 +0000 (00:18 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Sat, 22 Mar 2025 09:28:13 +0000 (09:28 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Fri, 21 Mar 2025 00:20:10 +0000 (00:20 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Thu, 20 Mar 2025 00:20:51 +0000 (00:20 +0000)] 
Daily bump.

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

4 months agoDaily bump.
GCC Administrator [Tue, 18 Mar 2025 00:20:36 +0000 (00:20 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Mon, 17 Mar 2025 00:19:25 +0000 (00:19 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Sun, 16 Mar 2025 00:20:00 +0000 (00:20 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Sat, 15 Mar 2025 00:20:20 +0000 (00:20 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Fri, 14 Mar 2025 00:19:23 +0000 (00:19 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Thu, 13 Mar 2025 00:19:57 +0000 (00:19 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Wed, 12 Mar 2025 00:20:32 +0000 (00:20 +0000)] 
Daily bump.

4 months agod: Fix regression returning from function with invariants [PR119139]
Iain Buclaw [Tue, 11 Mar 2025 16:56:18 +0000 (17:56 +0100)] 
d: Fix regression returning from function with invariants [PR119139]

An optimization was added in GDC-12 which sets the TREE_READONLY flag on
all local variables with the storage class `const' assigned.  For some
reason, const is also being added by the front-end to `__result'
variables in non-virtual functions, which ends up getting wrong code by
the gimplify pass promoting the local to static storage.

A bug has been raised upstream, as this looks like an error in the AST.
For now, turn off setting TREE_READONLY on all result variables.

PR d/119139

gcc/d/ChangeLog:

* decl.cc (get_symbol_decl): Don't set TREE_READONLY for __result
declarations.

gcc/testsuite/ChangeLog:

* gdc.dg/pr119139.d: New test.

(cherry picked from commit 81582ca6cb692098c1bda7995aec46c6cbfbfcb3)

4 months agoFix folding of BIT_NOT_EXPR for POLY_INT_CST [PR118976]
Richard Sandiford [Tue, 11 Mar 2025 15:51:55 +0000 (15:51 +0000)] 
Fix folding of BIT_NOT_EXPR for POLY_INT_CST [PR118976]

There was an embarrassing typo in the folding of BIT_NOT_EXPR for
POLY_INT_CSTs: it used - rather than ~ on the poly_int.  Not sure
how that happened, but it might have been due to the way that
~x is implemented as -1 - x internally.

gcc/
PR tree-optimization/118976
* fold-const.cc (const_unop): Use ~ rather than - for BIT_NOT_EXPR.
* config/aarch64/aarch64.cc (aarch64_test_sve_folding): New function.
(aarch64_run_selftests): Run it.

(cherry picked from commit 78380fd7f743e23dfdf013d68a2f0347e1511550)

4 months agoaarch64: Fix folding of degenerate svwhilele case [PR117045]
Richard Sandiford [Tue, 11 Mar 2025 15:51:54 +0000 (15:51 +0000)] 
aarch64: Fix folding of degenerate svwhilele case [PR117045]

The svwhilele folder mishandled the degenerate case in which
the second argument is the maximum integer.  In that case,
the result is all-true regardless of the first parameter:

  If the second scalar operand is equal to the maximum signed integer
  value then a condition which includes an equality test can never fail
  and the result will be an all-true predicate.

This is because the conceptual "increment the first operand
by 1 after each element" is done modulo the range of the operand.
The GCC code was instead treating it as infinite precision.
whilele_5.c even had a test for the incorrect behaviour.

The easiest fix seemed to be to handle that case specially before
doing constant folding.  This also copes with variable first operands.

gcc/
PR target/116999
PR target/117045
* config/aarch64/aarch64-sve-builtins-base.cc
(svwhilelx_impl::fold): Check for WHILELTs of the minimum value
and WHILELEs of the maximum value.  Fold them to all-false and
all-true respectively.

gcc/testsuite/
PR target/116999
PR target/117045
* gcc.target/aarch64/sve/acle/general/whilele_5.c: Fix bogus
expected result.
* gcc.target/aarch64/sve/acle/general/whilele_11.c: New test.
* gcc.target/aarch64/sve/acle/general/whilele_12.c: Likewise.

(cherry picked from commit 50e7c51b0a0e9dc1d93f829016ae743b4f2e5070)

4 months agoaarch64: Fix caller saves of VNx2QI [PR116238]
Richard Sandiford [Tue, 11 Mar 2025 15:51:54 +0000 (15:51 +0000)] 
aarch64: Fix caller saves of VNx2QI [PR116238]

The testcase contains a VNx2QImode pseudo that is live across a call
and that cannot be allocated a call-preserved register.  LRA quite
reasonably tried to save it before the call and restore it afterwards.
Unfortunately, the target told it to do that in SImode, even though
punning between SImode and VNx2QImode is disallowed by both
TARGET_CAN_CHANGE_MODE_CLASS and TARGET_MODES_TIEABLE_P.

The natural class to use for SImode is GENERAL_REGS, so this led
to an unsalvageable situation in which we had:

  (set (subreg:VNx2QI (reg:SI A) 0) (reg:VNx2QI B))

where A needed GENERAL_REGS and B needed FP_REGS.  We therefore ended
up in a reload loop.

The hooks above should ensure that this situation can never occur
for incoming subregs.  It only happened here because the target
explicitly forced it.

The decision to use SImode for modes smaller than 4 bytes dates
back to the beginning of the port, before 16-bit floating-point
modes existed.  I'm not sure whether promoting to SImode really
makes sense for any FPR, but that's a separate performance/QoI
discussion.  For now, this patch just disallows using SImode
when it is wrong for correctness reasons, since that should be
safer to backport.

gcc/
PR testsuite/116238
* config/aarch64/aarch64.cc (aarch64_hard_regno_caller_save_mode):
Only return SImode if we can convert to and from it.

gcc/testsuite/
PR testsuite/116238
* gcc.target/aarch64/sve/pr116238.c: New test.

(cherry picked from commit ec9d6d45191f639482344362d048294e74587ca3)

4 months agoDaily bump.
GCC Administrator [Tue, 11 Mar 2025 00:20:15 +0000 (00:20 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Mon, 10 Mar 2025 00:18:58 +0000 (00:18 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Sun, 9 Mar 2025 00:19:08 +0000 (00:19 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Sat, 8 Mar 2025 00:19:50 +0000 (00:19 +0000)] 
Daily bump.

4 months agoarm: Handle fixed PIC register in require_pic_register (PR target/115485)
Christophe Lyon [Mon, 3 Mar 2025 11:12:18 +0000 (11:12 +0000)] 
arm: Handle fixed PIC register in require_pic_register (PR target/115485)

Commit r9-4307-g89d7557202d25a forgot to accept a fixed PIC register
when extending the assert in require_pic_register.

arm_pic_register can be set explicitly by the user
(e.g. -mpic-register=r9) or implicitly as the default value with
-fpic/-fPIC/-fPIE and -mno-pic-data-is-text-relative -mlong-calls, and
we want to use/accept it when recording cfun->machine->pic_reg as used
to be the case.

PR target/115485
gcc/
* config/arm/arm.cc (require_pic_register): Fix typos in
comment. Handle fixed arm_pic_register.

gcc/testsuite/
* g++.target/arm/pr115485.C: New test.

(cherry picked from commit b1d0ac28de643e7c810e407a0668737131cdcc00)

4 months agoDaily bump.
GCC Administrator [Fri, 7 Mar 2025 00:19:12 +0000 (00:19 +0000)] 
Daily bump.

4 months agoDaily bump.
GCC Administrator [Thu, 6 Mar 2025 00:20:56 +0000 (00:20 +0000)] 
Daily bump.

4 months agotestsuite: Add tests for already fixed PR [PR119071]
Jakub Jelinek [Tue, 4 Mar 2025 08:52:22 +0000 (09:52 +0100)] 
testsuite: Add tests for already fixed PR [PR119071]

Uros' r15-7793 fixed this PR as well, I'm just committing tests
from the PR so that it can be closed.

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

PR rtl-optimization/119071
* gcc.dg/pr119071.c: New test.
* gcc.c-torture/execute/pr119071.c: New test.

(cherry picked from commit ccf9db9a6fa4b5bc7aad5e9603e2ac71984142a0)

4 months agocombine: Discard REG_UNUSED note in i2 when register is also referenced in i3 [PR118739]
Uros Bizjak [Wed, 12 Feb 2025 10:19:57 +0000 (11:19 +0100)] 
combine: Discard REG_UNUSED note in i2 when register is also referenced in i3 [PR118739]

The combine pass is trying to combine:

Trying 16, 22, 21 -> 23:
   16: r104:QI=flags:CCNO>0
   22: {r120:QI=r104:QI^0x1;clobber flags:CC;}
      REG_UNUSED flags:CC
   21: r119:QI=flags:CCNO<=0
      REG_DEAD flags:CCNO
   23: {r110:QI=r119:QI|r120:QI;clobber flags:CC;}
      REG_DEAD r120:QI
      REG_DEAD r119:QI
      REG_UNUSED flags:CC

and creates the following two insn sequence:

modifying insn i2    22: r104:QI=flags:CCNO>0
      REG_DEAD flags:CC
deferring rescan insn with uid = 22.
modifying insn i3    23: r110:QI=flags:CCNO<=0
      REG_DEAD flags:CC
deferring rescan insn with uid = 23.

where the REG_DEAD note in i2 is not correct, because the flags
register is still referenced in i3.  In try_combine() megafunction,
we have this part:

--cut here--
    /* Distribute all the LOG_LINKS and REG_NOTES from I1, I2, and I3.  */
    if (i3notes)
      distribute_notes (i3notes, i3, i3, newi2pat ? i2 : NULL,
elim_i2, elim_i1, elim_i0);
    if (i2notes)
      distribute_notes (i2notes, i2, i3, newi2pat ? i2 : NULL,
elim_i2, elim_i1, elim_i0);
    if (i1notes)
      distribute_notes (i1notes, i1, i3, newi2pat ? i2 : NULL,
elim_i2, local_elim_i1, local_elim_i0);
    if (i0notes)
      distribute_notes (i0notes, i0, i3, newi2pat ? i2 : NULL,
elim_i2, elim_i1, local_elim_i0);
    if (midnotes)
      distribute_notes (midnotes, NULL, i3, newi2pat ? i2 : NULL,
elim_i2, elim_i1, elim_i0);
--cut here--

where the compiler distributes REG_UNUSED note from i2:

   22: {r120:QI=r104:QI^0x1;clobber flags:CC;}
      REG_UNUSED flags:CC

via distribute_notes() using the following:

--cut here--
  /* Otherwise, if this register is used by I3, then this register
     now dies here, so we must put a REG_DEAD note here unless there
     is one already.  */
  else if (reg_referenced_p (XEXP (note, 0), PATTERN (i3))
   && ! (REG_P (XEXP (note, 0))
 ? find_regno_note (i3, REG_DEAD,
    REGNO (XEXP (note, 0)))
 : find_reg_note (i3, REG_DEAD, XEXP (note, 0))))
    {
      PUT_REG_NOTE_KIND (note, REG_DEAD);
      place = i3;
    }
--cut here--

Flags register is used in I3, but there already is a REG_DEAD note in I3.
The above condition doesn't trigger and continues in the "else" part where
REG_DEAD note is put to I2.  The proposed solution corrects the above
logic to trigger every time the register is referenced in I3, avoiding the
"else" part.

PR rtl-optimization/118739

gcc/ChangeLog:

* combine.cc (distribute_notes) <case REG_UNUSED>: Correct the
logic when the register is used by I3.

gcc/testsuite/ChangeLog:

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

(cherry picked from commit a92dc3fe31c95d56019b2fb95a58414bca06241f)

5 months agoDaily bump.
GCC Administrator [Wed, 5 Mar 2025 00:22:21 +0000 (00:22 +0000)] 
Daily bump.

5 months agoDaily bump.
GCC Administrator [Tue, 4 Mar 2025 00:20:32 +0000 (00:20 +0000)] 
Daily bump.

5 months agoDaily bump.
GCC Administrator [Mon, 3 Mar 2025 00:20:33 +0000 (00:20 +0000)] 
Daily bump.

5 months agod: Fix comparing uninitialized memory in dstruct.d [PR116961]
Iain Buclaw [Fri, 28 Feb 2025 18:22:36 +0000 (19:22 +0100)] 
d: Fix comparing uninitialized memory in dstruct.d [PR116961]

Floating-point emulation in the D front-end is done via a type named
`struct longdouble`, which in GDC is a small interface around the
real_value type. Because the D code cannot include gcc/real.h directly,
a big enough buffer is used for the data instead.

On x86_64, this buffer is actually bigger than real_value itself, so
when a new longdouble object is created with

    longdouble r;
    real_from_string3 (&r.rv (), buffer, mode);
    return r;

there is uninitialized padding at the end of `r`.  This was never a
problem when D was implemented in C++ (until GCC 12) as comparing two
longdouble objects with `==' would be forwarded to the relevant
operator== overload that extracted the underlying real_value.

However when the front-end was translated to D, such conditions were
instead rewritten into identity comparisons

    return exp.toReal() is CTFloat.zero

The `is` operator gets lowered as a call to `memcmp() == 0', which is
where the read of uninitialized memory occurs, as seen by valgrind.

==26778== Conditional jump or move depends on uninitialised value(s)
==26778==    at 0x911F41: dmd.dstruct._isZeroInit(dmd.expression.Expression) (dstruct.d:635)
==26778==    by 0x9123BE: StructDeclaration::finalizeSize() (dstruct.d:373)
==26778==    by 0x86747C: dmd.aggregate.AggregateDeclaration.determineSize(ref const(dmd.location.Loc)) (aggregate.d:226)
[...]

To avoid accidentally reading uninitialized data, explicitly initialize
all `longdouble` variables with an empty constructor on C++ side of the
implementation before initializing underlying real_value type it holds.

PR d/116961

gcc/d/ChangeLog:

* d-codegen.cc (build_float_cst): Change new_value type from real_t to
real_value.
* d-ctfloat.cc (CTFloat::fabs): Default initialize the return value.
(CTFloat::ldexp): Likewise.
(CTFloat::parse): Likewise.
* d-longdouble.cc (longdouble::add): Likewise.
(longdouble::sub): Likewise.
(longdouble::mul): Likewise.
(longdouble::div): Likewise.
(longdouble::mod): Likewise.
(longdouble::neg): Likewise.
* d-port.cc (Port::isFloat32LiteralOutOfRange): Likewise.
(Port::isFloat64LiteralOutOfRange): Likewise.

gcc/testsuite/ChangeLog:

* gdc.dg/pr116961.d: New test.

(cherry picked from commit f7bc17ebc9ef89700672ed7125da719f3558f3b7)

5 months agoDaily bump.
GCC Administrator [Sun, 2 Mar 2025 00:20:29 +0000 (00:20 +0000)] 
Daily bump.

5 months agoDaily bump.
GCC Administrator [Sat, 1 Mar 2025 13:06:08 +0000 (13:06 +0000)] 
Daily bump.

5 months agoDaily bump.
GCC Administrator [Fri, 28 Feb 2025 00:20:33 +0000 (00:20 +0000)] 
Daily bump.

5 months agoDaily bump.
GCC Administrator [Thu, 27 Feb 2025 00:20:42 +0000 (00:20 +0000)] 
Daily bump.

5 months agos390: Fix s390_valid_shift_count() for TI mode [PR118835]
Stefan Schulze Frielinghaus [Thu, 13 Feb 2025 08:13:06 +0000 (09:13 +0100)] 
s390: Fix s390_valid_shift_count() for TI mode [PR118835]

During combine we may end up with

(set (reg:DI 66 [ _6 ])
     (ashift:DI (reg:DI 72 [ x ])
                (subreg:QI (and:TI (reg:TI 67 [ _1 ])
                                   (const_wide_int 0x0aaaaaaaaaaaaaabf))
                           15)))

where the shift count operand does not trivially fit the scheme of
address operands.  Reject those operands, especially since
strip_address_mutations() expects expressions of the form
(and ... (const_int ...)) and fails for (and ... (const_wide_int ...)).

Thus, be more strict here and accept only CONST_INT operands.  Done by
replacing immediate_operand() with const_int_operand() which is enough
since the former only additionally checks for LEGITIMATE_PIC_OPERAND_P
and targetm.legitimate_constant_p which are always true for CONST_INT
operands.

While on it, fix indentation of the if block.

gcc/ChangeLog:

PR target/118835
* config/s390/s390.cc (s390_valid_shift_count): Reject shift
count operands which do not trivially fit the scheme of
address operands.

gcc/testsuite/ChangeLog:

* gcc.target/s390/pr118835.c: New test.

(cherry picked from commit ac9806dae30d07ab082ac341fe5646987753adcb)

5 months agoDaily bump.
GCC Administrator [Wed, 26 Feb 2025 00:20:22 +0000 (00:20 +0000)] 
Daily bump.

5 months agoDaily bump.
GCC Administrator [Tue, 25 Feb 2025 00:20:11 +0000 (00:20 +0000)] 
Daily bump.

5 months agoDaily bump.
GCC Administrator [Mon, 24 Feb 2025 00:20:39 +0000 (00:20 +0000)] 
Daily bump.

5 months agoDaily bump.
GCC Administrator [Sun, 23 Feb 2025 00:19:56 +0000 (00:19 +0000)] 
Daily bump.

5 months agoDaily bump.
GCC Administrator [Sat, 22 Feb 2025 00:19:13 +0000 (00:19 +0000)] 
Daily bump.

5 months agoDaily bump.
GCC Administrator [Fri, 21 Feb 2025 00:19:33 +0000 (00:19 +0000)] 
Daily bump.

5 months agolibgcc: On FreeBSD use GCC's crt objects for static linking
Dimitry Andric [Tue, 28 Jan 2025 17:36:16 +0000 (18:36 +0100)] 
libgcc: On FreeBSD use GCC's crt objects for static linking

Add crtbeginT.o to extra_parts on FreeBSD. This ensures we use GCC's
crt objects for static linking. Otherwise it could mix crtbeginT.o
from the base system with libgcc's crtend.o, possibly leading to
segfaults.

libgcc:
PR target/118685
* config.host (*-*-freebsd*): Add crtbeginT.o to extra_parts.

Signed-off-by: Dimitry Andric <dimitry@andric.com>
5 months agoDaily bump.
GCC Administrator [Thu, 20 Feb 2025 00:19:13 +0000 (00:19 +0000)] 
Daily bump.

5 months agoDaily bump.
GCC Administrator [Wed, 19 Feb 2025 00:19:10 +0000 (00:19 +0000)] 
Daily bump.

5 months agoDaily bump.
GCC Administrator [Tue, 18 Feb 2025 00:19:17 +0000 (00:19 +0000)] 
Daily bump.

5 months agoDaily bump.
GCC Administrator [Mon, 17 Feb 2025 00:18:55 +0000 (00:18 +0000)] 
Daily bump.

5 months agoDaily bump.
GCC Administrator [Sun, 16 Feb 2025 00:19:25 +0000 (00:19 +0000)] 
Daily bump.

5 months agoDaily bump.
GCC Administrator [Sat, 15 Feb 2025 00:18:50 +0000 (00:18 +0000)] 
Daily bump.

5 months agoDaily bump.
GCC Administrator [Fri, 14 Feb 2025 00:19:31 +0000 (00:19 +0000)] 
Daily bump.

5 months agoDaily bump.
GCC Administrator [Thu, 13 Feb 2025 00:19:41 +0000 (00:19 +0000)] 
Daily bump.

5 months agoDaily bump.
GCC Administrator [Wed, 12 Feb 2025 00:19:33 +0000 (00:19 +0000)] 
Daily bump.

5 months agox86: Correct ASM_OUTPUT_SYMBOL_REF
H.J. Lu [Tue, 11 Feb 2025 05:47:54 +0000 (13:47 +0800)] 
x86: Correct ASM_OUTPUT_SYMBOL_REF

x is not a macro argument.  It just happens to work as final.cc passes
x for 2nd argument:

final.cc:      ASM_OUTPUT_SYMBOL_REF (file, x);

PR target/118825
* config/i386/i386.h (ASM_OUTPUT_SYMBOL_REF): Replace x with
SYM.

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

5 months agoDaily bump.
GCC Administrator [Tue, 11 Feb 2025 00:19:35 +0000 (00:19 +0000)] 
Daily bump.

5 months agoDaily bump.
GCC Administrator [Mon, 10 Feb 2025 00:19:20 +0000 (00:19 +0000)] 
Daily bump.

5 months agoDaily bump.
GCC Administrator [Sun, 9 Feb 2025 00:18:50 +0000 (00:18 +0000)] 
Daily bump.

5 months agoDaily bump.
GCC Administrator [Sat, 8 Feb 2025 00:19:15 +0000 (00:19 +0000)] 
Daily bump.

5 months agoDaily bump.
GCC Administrator [Fri, 7 Feb 2025 00:20:42 +0000 (00:20 +0000)] 
Daily bump.

5 months agoDaily bump.
GCC Administrator [Thu, 6 Feb 2025 00:19:58 +0000 (00:19 +0000)] 
Daily bump.

5 months agoDaily bump.
GCC Administrator [Wed, 5 Feb 2025 00:20:24 +0000 (00:20 +0000)] 
Daily bump.

5 months agooptions: Adjust cl_optimization_compare to avoid checking ICE [PR115913]
Lewis Hyatt [Sun, 26 Jan 2025 23:57:00 +0000 (18:57 -0500)] 
options: Adjust cl_optimization_compare to avoid checking ICE [PR115913]

At the end of a sequence like:
 #pragma GCC push_options
 ...
 #pragma GCC pop_options

the handler for pop_options calls cl_optimization_compare() (as generated by
optc-save-gen.awk) to make sure that all global state has been restored to
the value it had prior to the push_options call. The verification is
performed for almost all entries in the global_options struct. This leads to
unexpected checking asserts, as discussed in the PR, in case the state of
warnings-related options has been intentionally modified in between
push_options and pop_options via a call to #pragma GCC diagnostic. Address
that by skipping the verification for CL_WARNING-flagged options.

gcc/ChangeLog:

PR middle-end/115913
* optc-save-gen.awk (cl_optimization_compare): Skip options with
CL_WARNING flag.

gcc/testsuite/ChangeLog:

PR middle-end/115913
* c-c++-common/cpp/pr115913.c: New test.

5 months agoDaily bump.
GCC Administrator [Tue, 4 Feb 2025 00:19:57 +0000 (00:19 +0000)] 
Daily bump.

6 months agoDaily bump.
GCC Administrator [Mon, 3 Feb 2025 00:19:35 +0000 (00:19 +0000)] 
Daily bump.

6 months agoDaily bump.
GCC Administrator [Sun, 2 Feb 2025 00:19:46 +0000 (00:19 +0000)] 
Daily bump.