Undefined behaviour in hotspot

David Chase david.r.chase at oracle.com
Tue Apr 22 12:20:17 UTC 2014


I'm pretty sure that -Wstrict-overflow is the one that we want,
and that to do this study we (we?) would compile with

-Wstrict-overflow=5 -Wno-error

but not -fwrapv and not -fno-strict-overflow.
-Wno-error is so you'll get to see all of them.

The flags are discussed here:
http://www.airs.com/blog/archives/120
http://thiemonagel.de/2010/01/signed-integer-overflow/

David


On 2014-04-21, at 2:30 PM, Omair Majid <omajid at redhat.com> wrote:

> My knowledge of C/C++ is fairly limited, so please bear with me. There
> are a few relevant options already listed in 'man gcc':
> 
> -Wstrict-overflow=n
>           This option is only active when -fstrict-overflow is active.
>           It warns about cases where the compiler optimizes based on
>           the assumption that signed overflow does not occur
> 
> -fwrapv
>           This option instructs the compiler to assume that signed
>           arithmetic overflow of addition, subtraction and
>           multiplication wraps around using twos-complement
>           representation. 
> 
> Do you mean others?



More information about the hotspot-dev mailing list