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: [email protected]
ReportedBy: [email protected]
CC: [email protected]
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs