[Bug tree-optimization/82697] [6/7/8 Regression] Wrong optimization with aliasing and "if"
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Oct 24 11:04:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82697
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
So cselim transforms
*pi = 1;
if (f)
*pl = 2;
into
*pi = 1;
if (!f)
tem = *pl;
else
tem = 2;
*pl = tem;
that is of course only valid in case we can validly load from *pl which we
can't in this case.
Given there's no check for validity here there's nothing else than using
alias-set zero for the load ...
We also have to avoid changing the dynamic type of the object which means
the store _also_ has to use alias-set zero.
I have a fix.
More information about the Gcc-bugs
mailing list