Cleaning up undefined behaviour in HotSpot

Vladimir Kozlov vladimir.kozlov at oracle.com
Fri Feb 12 00:36:01 UTC 2016


 > I think we need to have a policy that all UB, with the possible
 > exception of a couple of things which can be worked around with
 > compiler switched, gets fixed.

I agree with that (assuming it is not false positive or compiler's bug).

We (Hotspot team) welcome all fixes which remove UB in jdk 9 (current) 
sources. But it is up to jdk 8 update release and support teams to take 
those changes into 8u.

In Oracle we use only supported build configuration, as you called 'frozen':
https://wiki.openjdk.java.net/display/Build/Supported+Build+Platforms

If you know which flags we can use with gcc 4 to trigger the same 
warnings/errors, please, let us know so we can verify fixes.

Regards,
Vladimir

On 2/11/16 4:34 AM, Andrew Haley wrote:
> We're having problems with GCC 6 failing to build a working HotSpot
> in jdk8.
>
> I think this may be due to HotSpot's rather extensive use of undefined
> behaviour.  This includes, but is not limited to integer overflows,
> null pointer dereferences, and type aliasing violations.
>
> It's a big job to fix it all, but I could certainly create a patch.
> However, the other problem is that all versions are affected and will
> need to be patched in order to run with GCC 6.
>
>  From the point of view of proprietary products based on OpenJDK this
> perhaps isn't an issue because people can build and test with a
> "frozen" compiler, but of course it's a big problem for distributions
> who build with the system compiler.  (Mind you, it's quite possible
> that the proprietary JDK is broken but no-one noticed.  And this is a
> potential security nightmare.)
>
> So, not only must the current development sources be patched, but also
> JKD 8.  (And, for me, 7 and maybe 6.)
>
> I think we need to have a policy that all UB, with the possible
> exception of a couple of things which can be worked around with
> compiler switched, gets fixed.
>
> Comments, please...
>
> Andrew.
>


More information about the hotspot-dev mailing list