[Bug tree-optimization/65053] [5 Regression] PostgreSQL miscompilation

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Feb 13 16:43:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65053

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I believe this is a phiopt1 bug.
In *.ifcombine we have:
  <bb 2>:
  n_5 = foo ();
  if (n_5 != 0)
    goto <bb 3>;
  else
    goto <bb 4>;

  <bb 3>:
  # RANGE [0, 4294967294]
  u_6 = n_5 + 4294967295;

  <bb 4>:
  # u_3 = PHI <u_6(3), 4294967295(2)>
  goto <bb 6>;
which looks right, for non-zero n_5 u_6 really is != 0xffffffffU.
But then *.phiopt optimizes this into:
  <bb 2>:
  n_5 = foo ();
  # RANGE [0, 4294967294]
  u_6 = n_5 + 4294967295;
  goto <bb 4>;
which is wrong, either it should have adjusted the value range or drop it when
making u_6 unconditional.
What r220164 did is just start using the VR information during the next VRP
pass, but as the info is bogus due to phiopt, it resulted in wrong optimization
later on.



More information about the Gcc-bugs mailing list