This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/86554] Incorrect code generation with signed/unsigned comparison
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 18 Jul 2018 08:04:33 +0000
- Subject: [Bug middle-end/86554] Incorrect code generation with signed/unsigned comparison
- Auto-submitted: auto-generated
- References: <bug-86554-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86554
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue seems to be that we do
Value numbering ret_10 stmt = ret_10 = (int) _9;
Setting value number of ret_10 to ret_11 (changed)
so we correctly figure both ret are the same. We then continue
Value numbering ret_12 stmt = ret_12 = PHI <ret_10(3), ret_11(4)>
Setting value number of ret_12 to ret_11
...
Visiting control stmt ending BB 5: if (ret_12 <= 0)
Marking all edges out of BB 5 but (5 -> 6) as not executable
oops. We seem to have simplified this as
if (_8 + -2147483647 <= 0)
which given strict overflow rules is always true.
The issue here is that we did expression simplification of a value expression,
and this is a really really hard issue to fix. I'm currently working on a
complete rewrite of FRE for GCC9 which doesn't exhibit this issue (by design).
For some reason PRE code-hoisting re-introduces the issue by hoisting
the signed operation.