http://llvm.org/bugs/show_bug.cgi?id=8547

           Summary: likely x86 miscompile using clang
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]


The -O1 result looks wrong.

reg...@home:~$ clang -O0 foo.c -o foo
reg...@home:~$ ./foo
g_2 = 64
reg...@home:~$ clang -O1 foo.c -o foo
reg...@home:~$ ./foo
g_2 = 320
reg...@home:~$ cat foo.c
int g_2;

int printf(const char *format, ...);

int main(void) {
  for (g_2 = 0; g_2 > -1; g_2++)
    {
      g_2 = (char)(g_2 << 6);
      if (g_2)
    break;
      g_2 = 4;
    }
  printf("g_2 = %d\n", g_2);
  return 0;
} 
reg...@home:~$ clang -v
clang version 2.9 (trunk 118140)
Target: i386-pc-linux-gnu
Thread model: posix

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to