[LLVMbugs] [Bug 12514] New: likely wrong code bug

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 9 20:59:14 PDT 2012


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

             Bug #: 12514
           Summary: likely wrong code bug
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: regehr at cs.utah.edu
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


[regehr at dyson r16]$ clang small.c
[regehr at dyson r16]$ ./a.out 
1
[regehr at dyson r16]$ clang -O small.c
[regehr at dyson r16]$ ./a.out 
0
[regehr at dyson r16]$ cat small.c
int printf (const char *, ...);
int a, b, d = 1, e, f;
int *c;
char
fn1 (char p1)
{
    return p1 ? p1 : 1 << a;
}

void
fn2 ()
{
    if (fn1 (~d))
        e = 1;
}

int
main ()
{
    d &= (c == 0) > (0 >= b) == 0;
    f = 0;
    fn2 ();
    printf ("%d\n", e);
    return 0;
}
[regehr at dyson r16]$ clang -v
clang version 3.1 (trunk 154369)
Target: x86_64-unknown-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.



More information about the llvm-bugs mailing list