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.

Reply via email to