RFR(M): 8073315: Enable gcc -Wtype-limits and fix upcoming issues.

Lindenmaier, Goetz goetz.lindenmaier at sap.com
Tue Feb 17 11:42:48 UTC 2015


We fixed all the warnings showing with -Wtype-limits and gcc in our VM.
I would like to contribute these small changes.

This warning detects unnecessary compares for >= 0 of unsigned values.

At least one warning unveils a real bug. In memory/blockOffsetTable.cpp,
BlockOffsetArrayContigSpace::last_active_index(), the compare to >=0
tries to prevent an underflow, but the value is unsigned.

Further useless compares in real code are in os_linux.cpp,
opto/graphKit.cpp, prims/jvmtiRedefineClasses.cpp

In some places debug code with constant debug flags caused
warnings in the opt build (g1/concurrentMark.cpp, classfile/systemDictionary.cpp)

The remaining warnings occur in asserts, which is also the biggest part.

The change also removes an empty #ifdef ASSERT .

Please review this change.  I please need a sponsor.

I tested this on linuxx86_64 with gcc 4.1.2, 4.3 and 4.8.  Further I ran the patch
with our nightly builds and tests of jdk9,see

Best regards,

More information about the hotspot-dev mailing list