This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/49419] [4.6/4.7 regression] gcc -O2 miscompiles gp2c
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 15 Jun 2011 12:19:40 +0000
- Subject: [Bug target/49419] [4.6/4.7 regression] gcc -O2 miscompiles gp2c
- Auto-submitted: auto-generated
- References: <bug-49419-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49419
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-06-15 12:19:00 UTC ---
So, i_47 which is the i value on entry of the second loop is determined to be
[0, +INF(OVF)] and something goes wrong afterwards. The bug will be there, but
I should note that VRP should easily prove that i never overflows.
Simpler testcases for that:
void bar (void);
void foo (int x, int y)
{
if (x < y)
{
if (x == __INT_MAX__)
bar ();
}
}
void baz (int x, int y, int z)
{
if (x < y || x < z)
{
if (x == __INT_MAX__)
bar ();
}
}
Here IMNSHO vrp should optimize the call to bar away, as when x is smaller than
some variable of the same type, it can't be the maximum of that type, because
even if the other number is __INT_MAX__, x must be smaller than that.