GCC sometimes aliases symbols if they refer to identical data. However, in order for this to be legitimate optimization, it must be ensured that the code will be accessed in the same way. This is not always the case, an example where this generates wrong code is PR92606. Such a new hook needs at least the following information to disallow aliasing by means of .set or similar means: * The attributes specified for either objects. * The address spaces specified for either objects.
Dup of at least PR92294 and PR54666; I thought there was a much older bug dealing with the alias attribute but I can't seem to find it right now.
(In reply to Andrew Pinski from comment #1) > Dup of at least PR92294 and PR54666; These PRs are different because no target hook is needed to see that the code is wrong. This is different with PR92606 because a target attribute is involved. Hence this PR for a new target hook that can tell whether such transformation might not be legitimate {apart from generic reasons}.
For the time being, -fno-ipa-icf-variables might be used as a work-around.