Skip to content

Releases/gcc 12 #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2,930 commits into
base: master
Choose a base branch
from
Open

Releases/gcc 12 #65

wants to merge 2,930 commits into from

Conversation

jacopobrusini
Copy link

Support for Apple Silicon!!!

@jwakely
Copy link
Contributor

jwakely commented Feb 21, 2024

This is an unofficial mirror that has nothing to do with the GCC project, so submitting pull requests here is a waste of time.

Also, I have no idea what this pull request is trying to do but it would never be accepted even if it was submitted to the right place.

NinaRanns pushed a commit to NinaRanns/gcc that referenced this pull request Jan 28, 2025
…on-r15-7214-g0710024b5bd861

Contracts nonattr rebase on r15 7214 g0710024b5bd861
GCC Administrator and others added 27 commits March 16, 2025 00:20
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 20385cb)
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 b58f0e5)
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 4969dcd)
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.
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 fbcbbfe)
…bject_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 233972a)
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 ff5a14a)
rguenth and others added 30 commits June 24, 2025 10:17
When a loop is marked with

  #pragma GCC novector

the following makes sure to also skip BB vectorization for contained
blocks.  That avoids gcc.dg/vect/bb-slp-29.c failing on aarch64
because of extra BB vectorization therein.  I'm not specifically
dealing with sub-loops of novector loops, the desired semantics
isn't documented.

	PR tree-optimization/111125
	* tree-vect-slp.cc (vect_slp_function): Split at novector
	loop entry, do not push blocks in novector loops.

(cherry picked from commit 43da77a)
The first argument is supposed to be a type, not a decl.

	PR c++/79786
gcc/cp/
	* rtti.cc (emit_tinfo_decl): Fix DATA_ABI_ALIGNMENT invocation.

(cherry picked from commit 6ec1982)
The following disables redundant store elimination to hard register
variables which isn't valid.

	PR tree-optimization/87984
	* tree-ssa-dom.cc (dom_opt_dom_walker::optimize_stmt): Do
	not perform redundant store elimination to hard register
	variables.
	* tree-ssa-sccvn.cc (eliminate_dom_walker::eliminate_stmt):
	Likewise.

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

(cherry picked from commit 535115c)
The following fixes a thinko in the handling of interposed weak
definitions which confused the interposition check in
get_availability by setting DECL_EXTERNAL too early.

	PR lto/91299
gcc/lto/
	* lto-symtab.cc (lto_symtab_merge_symbols): Set DECL_EXTERNAL
	only after calling get_availability.

gcc/testsuite/
	* gcc.dg/lto/pr91299_0.c: New testcase.
	* gcc.dg/lto/pr91299_1.c: Likewise.

(cherry picked from commit bc34db5)
When we gimplify &MEM[0B + 4] we are re-folding the address in case
types are not canonical which ends up with a constant address that
recompute_tree_invariant_for_addr_expr ICEs on.  Properly guard
that call.

	PR middle-end/101478
	* gimplify.cc (gimplify_addr_expr): Check we still have an
	ADDR_EXPR before calling recompute_tree_invariant_for_addr_expr.

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

(cherry picked from commit 33ead64)
view_converted_memref_p was checking the reference type against the
pointer type of the offset operand rather than its pointed-to type
which leads to all refs being subject to view-convert treatment
in get_alias_set causing numerous testsuite fails but with its
new uses from r15-512-g9b7cad5884f21c is also a wrong-code issue.

	PR middle-end/115110
	* tree-ssa-alias.cc (view_converted_memref_p): Fix.

(cherry picked from commit a5b3721)
PR107467 ended up being fixed by the fix for PR115110, but let's
add the testcase on top.

gcc/testsuite/ChangeLog:
	PR tree-optimization/107467
	PR middle-end/115110

	* g++.dg/lto/pr107467_0.C: New test.

(cherry picked from commit 4e09ae3)
We currently record a kill for

  *x_4(D) = always_throws ();

because we consider the store always executing since the appropriate
check for whether the stmt could throw is guarded by
!cfun->can_throw_non_call_exceptions.

	PR ipa/111245
	* ipa-modref.cc (modref_access_analysis::analyze_store): Do
	not guard the check of whether the stmt could throw by
	cfun->can_throw_non_call_exceptions.

	* g++.dg/torture/pr111245.C: New testcase.

(cherry picked from commit e6037af)
When we get a zero distance vector we still have to check for the
situation of a common inner loop with zero distance.  But we can
still allow a zero distance for the loop we distribute
(gcc.dg/tree-ssa/ldist-33.c is such a case).  This is because
zero distances in non-outermost loops are a misrepresentation
of dependence by dependence analysis.

Note that test coverage of loop distribution of loop nests is
very low.

	PR tree-optimization/112859
	PR tree-optimization/115347
	* tree-loop-distribution.cc
	(loop_distribution::pg_add_dependence_edges): For a zero
	distance vector still make sure to not have an inner
	loop with zero distance.

	* gcc.dg/torture/pr112859.c: New testcase.
	* gcc.dg/torture/pr115347.c: Likewise.
	* gcc.dg/tree-ssa/ldist-36.c: Adjust.

(cherry picked from commit 04ba130)
This adds a comment before the workaround, indicating flaky
dependence analysis.

	PR tree-optimization/112859
	* tree-loop-distribution.cc
	(loop_distribution::pg_add_dependence_edges): Add comment.

(cherry picked from commit 3ccbc8c)
When we process function types we strip volatile and const qualifiers
after building a simplified type variant (which preserves those).
The qualified type handling of both isn't really compatible, so avoid
bad interaction by swapping this, first dropping const/volatile
qualifiers and then building the simplified type thereof.

	PR lto/113207
	* ipa-free-lang-data.cc (free_lang_data_in_type): First drop
	const/volatile qualifiers from function argument types,
	then build a simplified type.

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

(cherry picked from commit a55e14b)
The following makes sure to also walk CONSTRUCTOR element indexes
which can be FIELD_DECLs, referencing otherwise unused types we
need to clean.  walk_tree only walks CONSTRUCTOR element data.

	PR lto/114501
	* ipa-free-lang-data.cc (find_decls_types_r): Explicitly
	handle CONSTRUCTORs as walk_tree handling of those is
	incomplete.

	* g++.dg/pr114501_0.C: New testcase.

(cherry picked from commit fdd95e1)
When there's an inner loop without virtual header PHI but the outer
loop has one the fusion process cannot handle the need to create
an inner loop virtual header PHI.  Punt in this case.

	PR tree-optimization/117113
	* gimple-loop-jam.cc (unroll_jam_possible_p): Detect when
	we cannot handle virtual SSA update.

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

(cherry picked from commit 0675eb1)
The following addresses a bug in tree_could_trap_p leading to
hoisting of a possibly trapping, because of out-of-bound, access.
We only ensured the first accessed byte is within a decl there,
the patch makes sure the whole base of the reference is within it.
This is pessimistic if a handled component would then subset to
a sub-object within the decl but upcasting of a decl to larger
types should be uncommon, questionable, and wrong without
-fno-strict-aliasing.

The testcase is a bit fragile, but I could not devise a (portable)
way to ensure an out-of-bound access to a decl would fault.

	PR tree-optimization/117424
	* tree-eh.cc (tree_could_trap_p): Verify the base is
	fully contained within a decl.

	* gcc.dg/tree-ssa/ssa-lim-25.c: New testcase.

(cherry picked from commit f1e776c)
We are detecting a cycle as double reduction where the inner loop
cycle has extra out-of-loop uses.  This clashes at least with
assumptions from the SLP discovery code which says the cycle
isn't reachable from another SLP instance.  It also was not intended
to support this case, in fact with GCC 14 we seem to generate wrong
code here.

	PR tree-optimization/119057
	* tree-vect-loop.cc (check_reduction_path): Add argument
	specifying whether we're analyzing the inner loop of a
	double reduction.  Do not allow extra uses outside of the
	double reduction cycle in this case.
	(vect_is_simple_reduction): Adjust.

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

(cherry picked from commit 758de62)
The following testcase runs into a re-gimplification issue during
inlining when processing

  MEM[(struct e *)this_2(D)].a = {};

where re-gimplification does not handle assignments in the same
way than the gimplifier but instead relies on rhs_predicate_for
and gimplifying the RHS standalone.  This fails to handle
special-casing of CTORs.  The is_gimple_mem_rhs_or_call predicate
already handles clobbers but not empty CTORs so we end up in
the fallback code trying to force the CTOR into a separate stmt
using a temporary - but as we have a non-copyable type here that ICEs.

The following generalizes empty CTORs in is_gimple_mem_rhs_or_call
since those need no additional re-gimplification.

	PR middle-end/119119
	* gimplify.cc (is_gimple_mem_rhs_or_call): All empty CTORs
	are OK when not a register type.

	* g++.dg/torture/pr11911.C: New testcase.

(cherry picked from commit 3bd61c1)
The following makes sure to reject the attempts to emulate a vector
gather when the discovered index vector type is a vector mask.

	PR tree-optimization/119534
	* tree-vect-stmts.cc (get_load_store_type): Reject
	VECTOR_BOOLEAN_TYPE_P offset vector type for emulated gathers.

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

(cherry picked from commit d0cc14c)
We currently only INTEGER_CST, but not POLY_INT_CST, which leads
to the situation that when the POLY_INT_CST is only indrectly
present via a SSA def the IL is valid but when propagated it's not.
That's unsustainable.

	PR middle-end/119706
	* gimple-expr.cc (is_gimple_mem_ref_addr): Also allow
	POLY_INT_CST.

(cherry picked from commit bf812c6)
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.
	* doc/invoke.texi: Update texi file.
When the C++ frontend clones a CTOR we do not copy ASM_EXPR constraints
fully as walk_tree does not recurse to TREE_PURPOSE of TREE_LIST nodes.
At this point doing that seems too dangerous so the following instead
avoids gimplification of ASM_EXPRs to clobber the shared constraints
and unshares it there, like it also unshares TREE_VALUE when it
re-writes a "+" output constraint to separate "=" output and matching
input constraint.

	PR middle-end/66279
	* gimplify.cc (gimplify_asm_expr): Copy TREE_PURPOSE before
	rewriting it for "+" processing.

	* g++.dg/pr66279.C: New testcase.

(cherry picked from commit 95f5d6c)
Add missing check to stmt_kills_ref_p for case that function
is terminated by EH before call return value kills the ref. In the PR
I tried to construct testcase but I don't know how to do that until I
annotate EH code with fnspec attributes which I will do in separate patch
and add a testcase.

	PR ipa/106057
	* tree-ssa-alias.cc (stmt_kills_ref_p): Check for external throw.

(cherry picked from commit 7fd3478)
gcc/ChangeLog:

	PR ipa/116055
	* ipa-modref.cc (analyze_function): Do not ICE when flags regress.

(cherry picked from commit 98baaa1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.