JDK-8256483 : [TESTBUG] serviceability/jvmti/GetClassMethods/libOverpassMethods.c fails to compile on gcc 4.4.x
  • Type: Bug
  • Component: hotspot
  • Sub-Component: test
  • Affected Version: 11.0.10
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: generic
  • Submitted: 2020-11-17
  • Updated: 2021-02-03
  • Resolved: 2020-11-20
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 11
11.0.10 b04Fixed
Related Reports
Relates :  
Relates :  
Description
Since 11.0.10+1 we are seeing build failures of test-images on RHEL 6 machines with old GCC like this (worked fine with 11.0.9.1+1):

/home/openjdk/jdk11u && /usr/bin/gcc -MMD -MF ./build/release/support/test/hotspot/jtreg/native/support/libOverpassMethods/libOverpassMethods.d.tmp -I ./build/release/support/modules_include/java.base -I ./build/release/support/modules_include/java.base/linux -I ./src/java.base/share/native/libjava -I ./src/java.base/unix/native/libjava -I ./src/hotspot/share/include -I ./src/hotspot/os/posix/include -pipe -fstack-protector -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DLINUX -DNDEBUG -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 -fno-strict-aliasing -m64 -D_LITTLE_ENDIAN -DARCH='"amd64"' -Damd64 -D_LP64=1 -fno-omit-frame-pointer -fno-delete-null-pointer-checks -fPIC -g -O2 -c -o ./build/release/support/test/hotspot/jtreg/native/support/libOverpassMethods/libOverpassMethods.o ./test/hotspot/jtreg/serviceability/jvmti/GetClassMethods/libOverpassMethods.c > >(/usr/bin/tee -a /home/openjdk/jdk11u/build/release/support/test/hotspot/jtreg/native/support/libOverpassMethods/libOverpassMethods.o.log) 2> >(/usr/bin/tee -a /home/openjdk/jdk11u/build/release/support/test/hotspot/jtreg/native/support/libOverpassMethods/libOverpassMethods.o.log >&2) || ( exitcode=$? && /bin/cp /home/openjdk/jdk11u/build/release/support/test/hotspot/jtreg/native/support/libOverpassMethods/libOverpassMethods.o.log /home/openjdk/jdk11u/build/release/make-support/failure-logs/support_test_hotspot_jtreg_native_support_libOverpassMethods_libOverpassMethods.o.log && /bin/cp /home/openjdk/jdk11u/build/release/support/test/hotspot/jtreg/native/support/libOverpassMethods/libOverpassMethods.o.cmdline /home/openjdk/jdk11u/build/release/make-support/failure-logs/support_test_hotspot_jtreg_native_support_libOverpassMethods_libOverpassMethods.o.cmdline && exit $exitcode ) )
Compiling libJvmtiGetAllModulesTest.c (for libJvmtiGetAllModulesTest.so)
./test/hotspot/jtreg/serviceability/jvmti/GetClassMethods/libOverpassMethods.c: In function ���Java_OverpassMethods_getJVMTIDeclaredMethods���:
./test/hotspot/jtreg/serviceability/jvmti/GetClassMethods/libOverpassMethods.c:98: error: ���for��� loop initial declarations are only allowed in C99 mode
./test/hotspot/jtreg/serviceability/jvmti/GetClassMethods/libOverpassMethods.c:98: note: use option -std=c99 or -std=gnu99 to compile your code
gmake[3]: *** [/home/openjdk/jdk11u/build/release/support/test/hotspot/jtreg/native/support/libOverpassMethods/libOverpassMethods.o] Error 1
gmake[3]: Leaving directory `/home/openjdk/jdk11u/make/test'
gmake[2]: *** [build-test-hotspot-jtreg-native] Error 1

Seems to have been caused by the backport of JDK-8216324

This seems like a JDK 11u only bug to me.
Comments
URL: https://hg.openjdk.java.net/jdk-updates/jdk11u/rev/59e507b62cfc User: goetz Date: 2020-11-25 07:28:25 +0000
25-11-2020

URL: https://hg.openjdk.java.net/jdk-updates/jdk11u-dev/rev/59e507b62cfc User: sgehwolf Date: 2020-11-20 18:26:54 +0000
20-11-2020

Fix Request (OpenJDK 11u): The backport of JDK-8216324 breaks the vanilla OpenJDK 11u build which builds with gcc 4.4.x. Patch above reviewed by Aleksey Shipilev and Goetz Lindenmaier. Low risk, test file only. RFR: https://mail.openjdk.java.net/pipermail/jdk-updates-dev/2020-November/004166.html
18-11-2020

The issue seems to be the initial declaration in the for loop. It's easy enough to fix. E.g. diff --git a/test/hotspot/jtreg/serviceability/jvmti/GetClassMethods/libOverpassMethods.c b/test/hotspot/jtreg/serviceability/jvmti/GetClassMethods/libOverpassMethods.c --- a/test/hotspot/jtreg/serviceability/jvmti/GetClassMethods/libOverpassMethods.c +++ b/test/hotspot/jtreg/serviceability/jvmti/GetClassMethods/libOverpassMethods.c @@ -95,7 +95,8 @@ return NULL; } - for (int i = 0; i < method_count; i++) { + int i; + for (i = 0; i < method_count; i++) { jint modifiers = 0; err = JNI_ENV_PTR(jvmti)->GetMethodModifiers(JNI_ENV_ARG2(jvmti, methods[i], &modifiers)); if (err != JVMTI_ERROR_NONE) {
17-11-2020