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

            Bug ID: 16982
           Summary: __attribute__((noreturn)) merged in an if-expression
                    "?:"
           Product: clang
           Version: 3.3
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

In the following code, if the parameter `err' is zero, the functions will
return.

good(0) returns fine, but bad(0) doesn't, the thread returns from dontexit()
into garbage memory.


void exit(int) __attribute__((noreturn));
void dontexit(int);

int good(int err)
{
    if(err)
        exit(0);
    else
        dontexit(0);
}

int bad(int err)
{
    (err ? exit : dontexit)(0);
}


It looks like the types "void (int)" and "void (int) __attribute__((noreturn))"
are being merged into "void (int)" for the ?: expression, and so clang assumes
"(err ? exit : dontexit)(0)" doesn't return.

This happens on both -O0, -Os and -O3.

Possibly related to #10347.

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