<html>
    <head>
      <base href="https://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 --- - SIMD code with -O2"
   href="https://llvm.org/bugs/show_bug.cgi?id=27833">27833</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>SIMD code with -O2
          </td>
        </tr>

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

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

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

        <tr>
          <th>OS</th>
          <td>MacOS X
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>kazunori.ueda.ku@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16396" name="attach_16396" title="v2d2.i and related source files">attachment 16396</a> <a href="attachment.cgi?id=16396&action=edit" title="v2d2.i and related source files">[details]</a></span>
v2d2.i and related source files

The enclosed program, compiled with clang -m32 -O2 *.i, produces a strange
output

  0x7b06e5ed, 0x7b06e44f, 0x7b06e5f5, 0x7b06e42f
  0x7b06e5f5, 0x7b06e42f, 0x0, 0x0
  segmentation fault: 11

from two successive printf statements in v2d2.i:

  printf("%p, %p, %p, %p\n",
         allocp[116], allocp[117], allocp[118], allocp[119]);
  x59 = ((q)((unsigned long)(&allocp[118]) + 0x1));
  printf("%p, %p, %p, %p\n",
         allocp[116], allocp[117], allocp[118], allocp[119]);

while clang -m32 -O1 *.i produces an expected output

  0x7c2d81ed, 0x7c2d804f, 0x7c2d81f5, 0x7c2d802f
  0x7c2d81ed, 0x7c2d804f, 0x7c2d81f5, 0x7c2d802f

I look into the assembly code of v2d2.c and found that -O2 uses SIMD
instructions while -O1 doesn't.

FYI, v2d2.c is a simplified version of a machine-generated program from our
compiler, and all the other .c files are just to make v2d2.c run.</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>