https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78568
Bug ID: 78568 Summary: Wtype-limits warning regression Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: sirl at gcc dot gnu.org Target Milestone: --- Created attachment 40179 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40179&action=edit testcase The attached testcase produces warnings with gcc-4.4.7 on RHEL6, but somewhere along the way it regressed. I've tested 4.6, 4.8, 4.9, 5, 6 and trunk, none of them warns anymore, but they all still happily optimize the comparisons away. gcc-4.4.7 produced: $ gcc -O2 -Wtype-limits -c Wtype-limits.c Wtype-limits.c: In function 'testa': Wtype-limits.c:4: warning: comparison is always true due to limited range of data type Wtype-limits.c: In function 'testb': Wtype-limits.c:12: warning: comparison is always true due to limited range of data type Wtype-limits.c: In function 'testc': Wtype-limits.c:20: warning: comparison is always true due to limited range of data type