neovim/neovim — pull request #513 by MarcWeber (2014-04-11 22:05:06+00:00)
Title: gcc is too smart

comment this line because its causing gcc warnings. There are more warnings like this (Just dropping -Wall for now). You may want to fix this in a different way eventually.

if (top > curbuf->b_ml.ml_line_count
|| top >= bot
|| bot > curbuf->b_ml.ml_line_count + 1)

Let's rewrite:

if ( top > N // 1
|| top >= bot // 2
|| N + 1 < bot) // 3

If 1 is not true, then we know top <= N, adding line 3 we get:

Now top <= N < N + 1 < bot

Thus top <= bot, thus line 2 will never be true, thus it can be
dropped. Thanks to roxfan @ #gcc to help me understand this.
gcc 4.7's error message is still very strange:

src/undo.c:253:7: error: assuming signed overflow does not occur when assuming that (X - c) > X is always false [-Werror=strict-overflow]
|| top >= bot
^
cc1: all warnings being treated as errors