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: unassignedclangb...@nondot.org
          Reporter: kazunori.ueda...@gmail.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to