]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fix misoptimization at -O2 in LTO mode
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 19 Mar 2025 07:55:04 +0000 (08:55 +0100)
committerEric Botcazou <ebotcazou@adacore.com>
Wed, 19 Mar 2025 07:57:37 +0000 (08:57 +0100)
commit5497ff92a38292d3b18ceb3fe284af83f3f8377e
treec6cfb04d296a4fa202cd150001a86f213380d821
parent21c83cd4732dfaa4d49c01231a4e28082add821a
Fix misoptimization at -O2 in LTO mode

This is a regression in recent releases. The problem is that the IPA mod/ref
pass looks through the (nominal) type of a pointer-to-discriminated-type
parameter in a call to a subprogram in order to see the (actual) type used
for the dereferences of the parameter in the callee, which is a
pointer-to-constrained-subtype.

Historically the discriminated type is marked with the may_alias attribute
because of the symmetric effect for the argument in the caller, so we mark
the constrained subtype with the attribute now for the sake of the callee.

gcc/ada/
* gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Record_Subtype>: Set
the may_alias attribute if a specific GCC type is built.
gcc/ada/gcc-interface/decl.cc