Undefined behaviour in hotspot

Florian Weimer fweimer at redhat.com
Tue Apr 22 14:56:06 UTC 2014


On 04/22/2014 03:21 PM, David Chase wrote:

> 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 ?

It turns it into

   (uintptr_t) ptr + (uintptr_t) len < (uintptr_t) ptr

which may or may not be what you want, depending whether you view 
addresses as signed or not.

(I still need to check MIPS, the obvious candidates behave the indicated 
way.)

-- 
Florian Weimer / Red Hat Product Security Team


More information about the hotspot-dev mailing list