Undefined behaviour in HotSpot

Vladimir Kozlov vladimir.kozlov at oracle.com
Tue Dec 1 17:57:07 UTC 2015


On 12/1/15 8:56 AM, Andrew Haley wrote:
> I've been kicking the tyres of the undefined behaviour sanitizer in
> GCC.  It picks up a few spurious errors in HotSpot but some serious
> ones too.  In particular, there are many integer overflows in C2, and
> these can lead to incorrect code generation.  I don't know that they
> actually cause any problems, but I do know that GCC's optimizations
> "know" that signed integer overflows never occur and generate code
> accordingly.
>
> Some of the code in C2 which checks for overflow (e.g.
> AddLNode::add_ring) looks very wrong to me.  I am not comfortable that
> an aggressive C++ optimizing compiler will generate the expected code
> for this function.
>
> Would it be useful at this stage in JDK9 to fix these?  If so, I can
> create some bug reports and webrevs.

Yes, please. Any enhancements to code quality are welcome. But beware
of false positive finding.

Thanks,
Vladimir

>
> Andrew.
>


More information about the hotspot-compiler-dev mailing list