[LLVMbugs] [Bug 11641] New: preprocessor with -O2 generates incorrect warnings
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Dec 22 13:17:00 PST 2011
http://llvm.org/bugs/show_bug.cgi?id=11641
Bug #: 11641
Summary: preprocessor with -O2 generates incorrect warnings
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: steven at ngls.net
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 7795
--> http://llvm.org/bugs/attachment.cgi?id=7795
unoptimized preprocessor output
Running just the prepocessor with and without -O2 generates different
output files. The -O2 file then generates incorrect warnings.
shell log follows:
bluishred:~/work 754 ? clang -O2 -fpic -Wno-format-security -E minigzip.c >
preprocessed_O2.c
bluishred:~/work 755 ? clang -fpic -Wno-format-security -E minigzip.c >
preprocessed.c
bluishred:~/work 756 ? clang -fpic -Wno-format-security -c preprocessed.c
bluishred:~/work 757 ? clang -O2 -fpic -Wno-format-security -c
preprocessed_O2.c
In file included from minigzip.c:1:
minigzip.c:283:2075: warning: array index 3 is past the end of the array (which
contains 3 elements) [-Warray-bounds]
...- ((__const unsigned char *) (__const char *) ("-d"))[2]); if (__s2_len >
2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const
char *) ("-d"))[3]); } } __result; }))) : __builtin_strcmp (*argv, "-d")))); })
== 0)
^ ~
minigzip.c:285:2080: warning: array index 3 is past the end of the array (which
contains 3 elements) [-Warray-bounds]
...- ((__const unsigned char *) (__const char *) ("-f"))[2]); if (__s2_len >
2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const
char *) ("-f"))[3]); } } __result; }))) : __builtin_strcmp (*argv, "-f")))); })
== 0)
^ ~
minigzip.c:287:2080: warning: array index 3 is past the end of the array (which
contains 3 elements) [-Warray-bounds]
...- ((__const unsigned char *) (__const char *) ("-h"))[2]); if (__s2_len >
2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const
char *) ("-h"))[3]); } } __result; }))) : __builtin_strcmp (*argv, "-h")))); })
== 0)
^ ~
minigzip.c:289:2080: warning: array index 3 is past the end of the array (which
contains 3 elements) [-Warray-bounds]
...- ((__const unsigned char *) (__const char *) ("-r"))[2]); if (__s2_len >
2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const
char *) ("-r"))[3]); } } __result; }))) : __builtin_strcmp (*argv, "-r")))); })
== 0)
^ ~
4 warnings generated.
bluishred:~/work 758 ? clang -v
clang version 3.1 (trunk 147153)
Target: x86_64-unknown-linux-gnu
Thread model: posix
--
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