[LLVMbugs] [Bug 21440] New: Inconsistent Output at O1 optimization level

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Oct 31 23:40:25 PDT 2014


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

            Bug ID: 21440
           Summary: Inconsistent Output at O1 optimization level
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: sardask01 at gmail.com
                CC: andrea.dibiagio at gmail.com, david.majnemer at gmail.com,
                    dexonsmith at apple.com, llvmbugs at cs.uiuc.edu,
                    rafael.espindola at gmail.com
    Classification: Unclassified

Test case :

suyog at suyog-Inspiron-N5010:~$ cat 1.c

#include<stdio.h>
int foo(long a) {
  long b = --a;
  return b > 0;
}
int main() {
  int x;
  if(foo(0x80000000L)==0)
    printf("Hi\n");
  else printf("Hello\n");
  return 0;
}


With -O0 output is : 
suyog at suyog-Inspiron-N5010:~$ Open/build-llvm-Desktop-Default/bin/clang -O0 1.c
suyog at suyog-Inspiron-N5010:~$ ./a.out 
Hello

With -O1 output is :
suyog at suyog-Inspiron-N5010:~$ Open/build-llvm-Desktop-Default/bin/clang -O1 1.c
suyog at suyog-Inspiron-N5010:~$ ./a.out 
Hi

With -O12 output is :
suyog at suyog-Inspiron-N5010:~$ Open/build-llvm-Desktop-Default/bin/clang -O2 1.c
suyog at suyog-Inspiron-N5010:~$ ./a.out 
Hello

The trunk revision is 220994

-- 
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/20141101/9b5555df/attachment.html>


More information about the llvm-bugs mailing list