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

            Bug ID: 83255
           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-alpha20171126 snapshot (r255155) produces wrong code w/ -O1 (-O2,
-O3, -Ofast) -floop-nest-optimize for the following snippet:

int rx, in;

int
main (void)
{
  const int tj = 3;
  int as[tj];
  static int l4;

  while (l4 < 1)
    {
      for (rx = 0; rx < tj; ++rx)
        {
          for (in = 0; in < tj; ++in)
            as[in] = 1;
          as[rx] = 0;
        }
      ++l4;
    }

  return as[tj - 1];
}

% gcc-8.0.0-alpha20171126 -O1 -o good znyz2wee.c && ./good
% echo $?
0

% gcc-8.0.0-alpha20171126 -O1 -floop-nest-optimize -o bad znyz2wee.c && ./bad
zsh: exit 1     ./bad
% echo $?                                                                    
1

Reply via email to