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

            Bug ID: 15714
           Summary: clang hangs at -O3 on expression
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

The following snippet (generated by csmith) causes top-of-trunk clang to get
stuck in an infinite loop at -O3 (-O2 and below are fine, as is clang 3.2). 
While it appears to invoke undefined behavior ((*d ^= 1 != (long)d)), hanging
is probably not the right thing to do.

$ clang-trunk -v
clang version 3.3 (trunk 179090)
Target: x86_64-pc-linux-gnu
Thread model: posix
$ clang-trunk -O2 -c test.c
$ clang-trunk -O3 -c test.c
<hangs>


int a, b, c;
int fn2();
void fn1 ()
{
    int *d, *e = &b;
    d = &b;
    *e = 0;
    c = 0;
    for (; c < 42; ++c)
    {
        (*d ^= 1 != (long)d) && fn2 ();
        if (a)
            break;
    }
}

int fn2 ()
{
    int *f = &b;
    *f = 1;
    return b;
}

void fn3 ()
{
    fn1 ();
}

-- 
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