[llvm-bugs] [Bug 27833] New: SIMD code with -O2

via llvm-bugs llvm-bugs at lists.llvm.org
Sun May 22 08:27:12 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=27833

            Bug ID: 27833
           Summary: SIMD code with -O2
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kazunori.ueda.ku at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 16396
  --> https://llvm.org/bugs/attachment.cgi?id=16396&action=edit
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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160522/9646202a/attachment-0001.html>


More information about the llvm-bugs mailing list