[LLVMbugs] [Bug 16069] New: Miscompilation of functiona call at -Os and above

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun May 19 10:20:50 PDT 2013


            Bug ID: 16069
           Summary: Miscompilation of functiona call at -Os and above
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dhazeghi at yahoo.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following code is miscompiled by clang trunk on x86_64-linux-gnu at -Os and
above, resulting in a SIGFPE when foo() is called.

$ clang-trunk -v
clang version 3.4 (trunk 182209)
Target: x86_64-pc-linux-gnu
Thread model: posix
$ clang-trunk -O1 test.c 
$ ./a.out 
$ clang-trunk -Os test.c 
$ ./a.out 
Floating point exception (core dumped)

int *a, b, *c, d;

int foo (short p, int q)
  return q == 0 || (p != 0 && q == 1) ? p : 1 % q;

int main ()
  c = &d;
  *c = ((int)&a) == 0;
  b = foo (0, d);

  return 0;

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/20130519/2c6a2b77/attachment.html>

More information about the llvm-bugs mailing list