[LLVMbugs] [Bug 16982] New: __attribute__((noreturn)) merged in an if-expression "?:"
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Aug 23 08:25:45 PDT 2013
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: unassignedclangbugs at nondot.org
Reporter: crabcaek at gmail.com
CC: llvmbugs at cs.uiuc.edu
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130823/294c0b97/attachment.html>
More information about the llvm-bugs
mailing list