This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ipa/81877] [7/8 Regression] Incorrect results with lto and -fipa-cp and -fipa-cp-clone
- From: "amonakov at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 17 Aug 2017 17:19:09 +0000
- Subject: [Bug ipa/81877] [7/8 Regression] Incorrect results with lto and -fipa-cp and -fipa-cp-clone
- Auto-submitted: auto-generated
- References: <bug-81877-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81877
--- Comment #9 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
I don't understand how LIM may deduce that store sinking is safe without
considering may-alias relations. If it is UB to write the same object from
different declared-independent iterations, then I think the correct deduction
would be "iteration count is at most 1", not "store sinking is safe"?
A C++ variation of the test, doesn't need -fno-tree-sra or asm() shenanigans:
void g(int p, int *out)
{
int x = 0, y;
#pragma GCC ivdep
for (int i = 0; i < 100; i++)
{
int &r = p ? x : y;
r = 42;
out[i] = x;
}
}