Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

likely wrong code bug #12621

Closed Quuxplusone closed 12 years ago

Quuxplusone commented 12 years ago
Bugzilla Link PR12514
Status RESOLVED FIXED
Importance P enhancement
Reported by John Regehr (regehr@cs.utah.edu)
Reported on 2012-04-09 22:59:14 -0700
Last modified on 2012-05-10 20:33:15 -0700
Version trunk
Hardware PC Linux
CC efriedma@quicinc.com, llvm-bugs@lists.llvm.org, rafael@espindo.la
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
[regehr@dyson r16]$ clang small.c
[regehr@dyson r16]$ ./a.out
1
[regehr@dyson r16]$ clang -O small.c
[regehr@dyson r16]$ ./a.out
0
[regehr@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@dyson r16]$ clang -v
clang version 3.1 (trunk 154369)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Quuxplusone commented 12 years ago

r156600.