This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/67690] [5/6 Regression] wrong code with -O2 on x86_64/Linux
- From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 24 Sep 2015 12:41:51 +0000
- Subject: [Bug tree-optimization/67690] [5/6 Regression] wrong code with -O2 on x86_64/Linux
- Auto-submitted: auto-generated
- References: <bug-67690-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67690
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu.org
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The problem in this PR is that in vrp2 the variable j_5 has a stale
SSA_NAME_RANGE_INFO, and we miscompile the code.
I suppose the code looked like this when the SSA_NAME_RANGE_INFO was set for
j_5:
<bb 2>:
_3 = *pi_2(D);
if (_3 >= 0)
goto <bb 3>;
else
goto <bb 4>;
<bb 3>:
j_4 = 2 - _3;
goto <bb 5>;
<bb 4>:
j_5 = 2 - _3;
so we know that _3 is negative, hence the range of j_5 must be [3, +INF].
That's correct. But then PRE changes the code to
<bb 2>:
_3 = *pi_2(D);
<bb 4>:
j_5 = 2 - _3;
but j_5 still has the same range info, i.e. [3, +INF] and that's incorrect at
this point. We can't assume any range for j_5.
So I think the problem is that something should have cleared the range info for
j_5.