[LLVMbugs] [Bug 15714] New: clang hangs at -O3 on expression

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Apr 9 19:42:40 PDT 2013


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: unassignedclangbugs at nondot.org
          Reporter: dhazeghi at yahoo.com
                CC: llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130410/d9f87eae/attachment.html>


More information about the llvm-bugs mailing list