https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79479
Bug ID: 79479 Summary: -Woverflow false alarm in unreachable expression Product: gcc Version: 6.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: eggert at gnu dot org Target Milestone: --- Created attachment 40722 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40722&action=edit gcc -m32 -Woverflow incorrectly complains about this Compile the attached program with: gcc -m32 -S too-large.c and it responds: too-large.c: In function ‘too_large’: too-large.c:5:18: warning: integer overflow in expression [-Woverflow] return 32768 * 65536L < x; Since the expression 32768 * 65536L cannot be executed on this platform (and this is by design, the code tests whether the multiplication is advisable before trying it), the warning is a false alarm. Bruno Haible originally reported this problem in bug-gnulib, here: http://lists.gnu.org/archive/html/bug-gnulib/2017-02/msg00041.html As this sort of thing is common in portable code that is checking for overflow correctly, I suggest disabling -Woverflow tests inside unreachable expressions.