http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60021
Bug ID: 60021 Summary: Inconsistent -Wsign-compare warnings for -O0 and -O1 Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: chengniansun at gmail dot com Gcc emits a -Wsign-compare warning for the following test case with the optimization flag -O0, but no warning with -O1. $: cat s.c.v2.c typedef long int64_t; void fn1(unsigned, char, long); void fn1(unsigned p_26, char c, long l) { /* */ const char l_1051 = 0; int64_t *l_1059 = &l; char *l_1062 = &c; p_26 < (*l_1062 = (1L == (*l_1059 = 0)) <= l_1051); } $: gcc-trunk -c -Wsign-compare -O0 s.c s.c: In function ‘fn1’: s.c:7:8: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] p_26 < (*l_1062 = (1L == (*l_1059 = 0)) <= l_1051); ^ $: gcc-trunk -c -Wsign-compare -O1 s.c $: gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/home/chengniansun/tools/gcc-trunk-binaries/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc-trunk/configure --enable-languages=c,c++ --disable-multilib --prefix=/home/chengniansun/tools/gcc-trunk-binaries : (reconfigured) ../gcc-trunk/configure --enable-languages=c,c++ --disable-multilib --prefix=/home/chengniansun/tools/gcc-trunk-binaries : (reconfigured) ../gcc-trunk/configure --enable-languages=c,c++ --disable-multilib --prefix=/home/chengniansun/tools/gcc-trunk-binaries Thread model: posix gcc version 4.9.0 20140131 (experimental) (GCC) $: