Subject: bug#49261: Segfault during loadup

From: Paul Eggert <[email-masked]>
Date: Tue, 13 Jul 2021 18:12:00 -0500

On 7/12/21 10:54 AM, Eli Zaretskii wrote:
> Then what is the -Woverflow option for?  Can you show an example of
> code which -Woverflow would flag that doesn't produce a bogus warning?

Sure: the GCC documentation says -Woverflow is supposed to warn about 
"compile-time overflow in constant expressions". So GCC should (and 
does) warn about this top-level declaration:

int x = INT_MAX + 1;

However, there is no overflow here:

unsigned a = -1, b = INT_MIN, c = LLONG_MAX;

and these declarations have well-defined behavior in C, so -Woverflow 
should not issue warnings for them even though they are unsigned 
conversions that change numeric values.

It might be useful to some programmers to generate warnings about these 
unsigned conversions, but this should be a separate -W option not 
-Woverflow. There's no overflow here.