<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - clang miscompiles with polly and newgvn at -O2 on valid code"
   href="https://bugs.llvm.org/show_bug.cgi?id=38358">38358</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang miscompiles with polly and newgvn at -O2 on valid code
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Polly
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Optimizer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>polly-dev@googlegroups.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>helloqirun@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Affected Polly version (hash tag) is: cdc7133937ea02211ebfeddab9be3ae7ff27229d

It miscompiles with both polly and newgvn enabled.

$ clang-trunk -v
clang version 7.0.0 (trunk 338211)



$ clang-trunk -mllvm -polly -mllvm -enable-newgvn -O2 abc.c ; ./a.out
1

$ clang-trunk -mllvm -polly -O2 abc.c ; ./a.out
0

$ clang-trunk -mllvm -enable-newgvn -O2 abc.c ; ./a.out
0

$ clang-trunk abc.c ; ./a.out
0

$ cat abc.c
void printf();
int a[56];
int b = 1, e = 3;
static int *c = &b;
char d;
short f;
int main() {
  int g = 0;
  for (; g < 56; g++)
    a[g] = g;
  int h = e;
  e = 2;
  for (; e > -19; e--) {
    f = 1 & h;
    if (f)
      for (; d != 8; --d)
        *c = 0;
  }
  printf("%X\n", b);
}</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>