Cleaning up undefined behaviour in HotSpot

Andrew Haley aph at redhat.com
Thu Feb 11 12:34:23 UTC 2016


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