http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52904
--- Comment #8 from eggert at gnu dot org ---
On 12/12/2013 10:19 AM, Laurent.Rineau__gcc at normalesup dot org wrote:
> The developer has two solutions:
> - remove that test,
> - or compile with -fno-strict-overflow.
Sure, and because of this problem, GNU Emacs has chosen #2, that
is, Emacs doesn't use -Wstrict-overflow any more. (Removing
the test would unnecessarily complicate Emacs, since the
test is needed on some platforms that are conditionally
compiled away in this stripped-down example.)
A goal of -Wstrict-overflow, at least at the 1 level, is to
not generate false alarms, so that it's generally useful in
real programs. This bug report gives one example where the
goal is not being met. Emacs currently has a half dozen or
so such examples of this (please see below for what the
current Emacs bzr trunk would output, if we enabled this
warning) and I thought that the GCC developers would find it
useful to see one of them. If you're not interested, that's
OK too; Emacs will continue to not use -Wstrict-overflow.
In file included from dispnew.c:26:0:
dispnew.c: In function ‘update_window’:
lisp.h:749:30: warning: assuming signed overflow does not occur when
simplifying conditional to constant [-Wstrict-overflow]
return num < lower ? lower : num <= upper ? num : upper;
dispnew.c: In function ‘update_frame_1’:
dispnew.c:4490:19: warning: assuming signed overflow does not occur when
simplifying conditional to constant [-Wstrict-overflow]
pause_p = 0 < i && i < FRAME_LINES (f) - 1;
fileio.c: In function ‘Finsert_file_contents’:
fileio.c:3630:11: warning: assuming signed overflow does not occur when
simplifying conditional to constant [-Wstrict-overflow]
if (nread < 0)
^
fileio.c:3632:16: warning: assuming signed overflow does not occur when
simplifying conditional to constant [-Wstrict-overflow]
else if (nread > 0)
^
eval.c: In function ‘backtrace_eval_unrewind’:
eval.c:3496:3: warning: assuming signed overflow does not occur when
simplifying conditional to constant [-Wstrict-overflow]
for (; distance > 0; distance--)
^
intervals.c: In function ‘offset_intervals’:
intervals.c:1364:6: warning: assuming signed overflow does not occur when
simplifying conditional to constant [-Wstrict-overflow]
if (length == TOTAL_LENGTH (tree))
^
intervals.c:1379:9: warning: assuming signed overflow does not occur when
simplifying conditional to constant [-Wstrict-overflow]
while (left_to_delete > 0)
^