JDK-8238909 : x86_32 fails gtest:power_of_2
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 14,15
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2020-02-11
  • Updated: 2020-07-17
  • Resolved: 2020-02-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 15
15 b11Fixed
Related Reports
Relates :  
Description
$ CONF=linux-x86-server-fastdebug make images run-test TEST=gtest:power_of_2

# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/shade/trunks/jdk-jdk/src/hotspot/share/utilities/powerOfTwo.hpp:76), pid=20756, tid=20756
#  assert(lz > 1) failed: Will overflow

V  [libjvm.so+0x16d476f]  VMError::report_and_die(int, char const*, char const*, char*, Thread*, unsigned char*, void*, void*, char const*, int, unsigned int)+0x3cf
V  [libjvm.so+0x16d5632]  VMError::report_and_die(Thread*, void*, char const*, int, char const*, char const*, char*)+0x32
V  [libjvm.so+0xa215a3]  report_vm_error(char const*, int, char const*, char const*, ...)+0x93
V  [libjvm.so+0x3e573d]  EnableIf<IsSigned<long long>::value, long long>::type round_up_power_of_2<long long>(long long) [clone .part.27]+0xed
V  [libjvm.so+0x3e808c]  void round_up_power_of_2<long long>()+0x45c
V  [libjvm.so+0x3e78ea]  power_of_2_round_up_power_of_2_test_Test::TestBody()+0x1a
V  [libjvm.so+0x26a1cc]  testing::Test::Run()+0xbc
V  [libjvm.so+0x26a331]  testing::TestInfo::Run()+0x121
V  [libjvm.so+0x26a40a]  testing::TestCase::Run()+0xaa
V  [libjvm.so+0x278308]  testing::internal::UnitTestImpl::RunAllTests()+0x458
V  [libjvm.so+0x27843c]  testing::UnitTest::Run()+0x5c
V  [libjvm.so+0x280b27]  runUnitTestsInner(int, char**)+0x297
V  [libjvm.so+0x280ddf]  runUnitTests+0xdf
C  [gtestLauncher+0x608]  main+0x2b
Comments
[~shade], could you please confirm that the defect is fixed in jdk15 w/ the patch? if it's so, please close/verify this bug as 'verified'
15-07-2020

URL: https://hg.openjdk.java.net/jdk/jdk/rev/bc5af528b6ec User: shade Date: 2020-02-13 16:06:27 +0000
13-02-2020

RFR: https://mail.openjdk.java.net/pipermail/hotspot-dev/2020-February/040806.html
12-02-2020

Testing this beauty: diff -r cdc7477bb1ce src/hotspot/share/utilities/powerOfTwo.hpp --- a/src/hotspot/share/utilities/powerOfTwo.hpp Thu Feb 06 16:53:33 2020 +0100 +++ b/src/hotspot/share/utilities/powerOfTwo.hpp Wed Feb 12 16:46:43 2020 +0100 @@ -69,5 +69,5 @@ STATIC_ASSERT(IsSigned<T>::value); assert(value > 0, "Invalid value"); - if (is_power_of_2(value)) { + if (LP64_ONLY(is_power_of_2(value)) NOT_LP64(is_power_of_2_long(value))) { return value; } @@ -85,5 +85,5 @@ STATIC_ASSERT(!IsSigned<T>::value); assert(value != 0, "Invalid value"); - if (is_power_of_2(value)) { + if (LP64_ONLY(is_power_of_2(value)) NOT_LP64(is_power_of_2_long(value))) { return value; }
12-02-2020

I got it. In here: template <typename T> inline typename EnableIf<IsSigned<T>::value, T>::type round_up_power_of_2(T value) { STATIC_ASSERT(IsIntegral<T>::value); STATIC_ASSERT(IsSigned<T>::value); assert(value > 0, "Invalid value"); if (is_power_of_2(value)) { <--- this fails for the actual power-of-two (u)int64_t on x86_32 due to truncation to intptr_t return value; } uint32_t lz = count_leading_zeros(value); assert(lz < sizeof(T) * BitsPerByte, "Sanity"); assert(lz > 1, "Will overflow"); return T(1) << (sizeof(T) * BitsPerByte - lz); } For x86_32, is_power_of_2_long(jlong) seems to fix it.
12-02-2020

JDK-7175279 is not directly related. This test fails even before FPU refactoring.
12-02-2020

linux-x86 is not a supported platform, and even so when trying to build it I run into JDK-8224949
12-02-2020

This failure is in native HotSpot code. I don't see anything in JDK-7175279 that would affect that; there aren't any build changes there.
12-02-2020

This was factored out of JDK-8238896, but surely they must be connected if they have appeared at the same time ??
12-02-2020