[LLVMbugs] [Bug 9774] New: False -Wunreachable-code warning in conditional expression
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Apr 21 03:54:22 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=9774
Summary: False -Wunreachable-code warning in conditional
expression
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: markus at oberhumer.com
CC: llvmbugs at cs.uiuc.edu
The following typescript shows that clang incorrectly warns about
unreachable code when using the ternary "if" operator:
$ cat test.c
#define MY_MAX(a,b) ((a) >= (b) ? (a) : (b))
void foo(int *s)
{
for (int i = 0; i < MY_MAX(2, 3); i++)
s[i] = 0;
}
$ clang -Wunreachable-code -c test.c
test.c:5:25: warning: will never be executed [-Wunreachable-code]
for (int i = 0; i < MY_MAX(2, 3); i++)
^~~~~~~~~~~~
test.c:5:32: note: instantiated from:
for (int i = 0; i < MY_MAX(2, 3); i++)
^
1 warning generated.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list