<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </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 --- - Wrong code"
   href="http://llvm.org/bugs/show_bug.cgi?id=21160">21160</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Wrong code
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>LLVM Codegen
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>ishiura-compiler@ml.kwansei.ac.jp
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>LLVM + clang 3.6 for x86_64 miscompiles the following code with optimize option
"-O1".

We have tried hard to minimize the code, but this is the best result we have
obtained so far.  

$ cat test.c
int a = 0;
int b = 0;
int c = 0;
int d = 0;
int e = 0;
int f = 0;
int g = 0;
int h = 0;
int i = 0;
int j = 0;
int k = 0;
int l = 0;
int m = 0;
int n = 0;
int o = 0;
int p = 0;

int main (void)
{
    volatile int q = 0;
    volatile int r = 0;
    volatile int s = 0;
    volatile int t = 0;
    volatile int u = 0;

    for (i = 0; i < 1; i++) {
        volatile int v = 1;
        a = m + 1;
        b = n;
        c = 1 / v;
        d = r + o;
        e = t;
        f = p + t;
        g = a + 1;
        h = g + q;
        j = s;
        k = r + l;
    }
    int w = g | (int)(16777219.0L + u);

    if (w != 16777219) {
        __builtin_abort();
    }

    return 0;
}

$ clang test.c -O1
$ ./a.out
Aborted (core dumped)

$ clang -v
clang version 3.6.0
Target: x86_64-unknown-linux-gnu
Thread model: posix</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>