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

            Bug ID: 83386
           Summary: [8 Regression] [graphite] Wrong code w/ -O1
                    -floop-nest-optimize
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---

gcc-8.0.0-alpha20171210 snapshot (r255534) produces wrong code w/ -O1 (-O2)
-floop-nest-optimize for the following snippet:

int xc, n1 = 0;
int bx[2];

int
main (void)
{
  int aj = 1;
  int cs;

  for (cs = aj; cs >= 0; --cs)
    {
      int sq;

      for (sq = 0; sq < 2; ++sq)
        {
          if (aj != 0)
            --n1;

          for (xc = 0; xc < 2; ++xc)
            bx[xc] = 0;
        }

      --aj;
    }

  return n1 != -2;
}

% gcc-8.0.0-alpha20171210 -O1 qavp1xqf.i -o good && ./good
% echo $?
0

% gcc-8.0.0-alpha20171210 -O1 -floop-nest-optimize qavp1xqf.i -o bad && ./bad 
zsh: exit 1     ./bad
% echo $?
1

Reply via email to