Undefined behaviour in hotspot

David Chase david.r.chase at oracle.com
Tue Apr 22 13:21:25 UTC 2014


On 2014-04-22, at 8:48 AM, Florian Weimer <fweimer at redhat.com> wrote:
> On 04/22/2014 02:20 PM, David Chase wrote:
>> 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.
> 
> Note that these options do not cover overflows/wraparounds in pointer arithmetic.

In what sense?  Are there versions of gcc that will optimize

  if (ptr + len < ptr)

to

  if (len < 0)

even if we set -fno-strict-overflow or -fwrapv ?
Or is it rather the case that the optimizations will never happen?

David



More information about the hotspot-dev mailing list