This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/37569] Loop incorrectly optimized to endless loop with -Os/-O2/-O3
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Sep 2008 08:57:41 -0000
- Subject: [Bug c/37569] Loop incorrectly optimized to endless loop with -Os/-O2/-O3
- References: <bug-37569-16736@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #7 from rguenth at gcc dot gnu dot org 2008-09-18 08:57 -------
Well ... VRP validly asserts that i_7 is not NULL after dereferencing it:
<bb 3>:
# i_2 = PHI <4094B(2), i_20(8)>
# sum_1 = PHI <0(2), sum_9(8)>
i_7 = i_2 + -4;
D.1209_8 = *i_7;
i_20 = ASSERT_EXPR <i_7, i_7 != 0B>;
sum_9 = D.1209_8 + sum_1;
if (i_20 != 0B)
goto <bb 8>;
else
goto <bb 4>;
<bb 8>:
goto <bb 3>;
which makes it optimize the check for i_20 != NULL to true.
You can work around this with -fno-delete-null-pointer-checks, but frankly
in a hosted i686-pc-cygwin environment the code is just broken.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37569