I am trying to build jdk18u on RHEL9 using GCC 11.3.1.
I am able to build it with no problems on RHEL8 using GCC 8.3.1.
I am able to build it with no problems on Fedora 29 using GCC 8.3.1.
But on RHEL9/Fedora 34/Fedora 36 using GCC 11.3.1/12.1.1 (the default for these
distros) I get the following error:
```
cat build/linux-x86_64-server-release/build.log
Building target 'images' in configuration 'linux-x86_64-server-release'
Compiling 1 files for BUILD_TOOLS_HOTSPOT
Compiling 8 files for BUILD_TOOLS_LANGTOOLS
Creating hotspot/variant-server/tools/adlc/adlc from 13 file(s)
Compiling 2 files for BUILD_JVMTI_TOOLS
Parsing 2 properties into enum-like class for jdk.compiler
Compiling 13 properties into resource bundles for jdk.javadoc
Compiling 16 properties into resource bundles for jdk.compiler
Compiling 12 properties into resource bundles for jdk.jdeps
Compiling 7 properties into resource bundles for jdk.jshell
Compiling 127 files for BUILD_java.compiler.interim
Compiling 403 files for BUILD_jdk.compiler.interim
Compiling 238 files for BUILD_jdk.javadoc.interim
Creating support/modules_libs/java.base/server/libjvm.so from 1081 file(s)
Compiling 31 files for BUILD_JRTFS
Creating support/modules_libs/java.base/jrt-fs.jar
Compiling 186 files for BUILD_TOOLS_JDK
Compiling 2 files for COMPILE_DEPEND
Compiling 1 properties into resource bundles for jdk.httpserver
Compiling 11 properties into resource bundles for jdk.jartool
Compiling 71 files for COMPILE_CREATE_SYMBOLS
Compiling 11 properties into resource bundles for jdk.management.agent
Compiling 3 properties into resource bundles for jdk.jdi
Compiling 5 properties into resource bundles for jdk.jlink
Compiling 3 properties into resource bundles for jdk.jlink
Compiling 1 properties into resource bundles for jdk.jlink
Compiling 224 properties into resource bundles for jdk.localedata
/usr/src/jdk18u/src/hotspot/cpu/x86/assembler_x86.cpp: In member function 'void
Assembler::evprord(XMMRegister, KRegister, XMMRegister, int, bool, int)':
/usr/src/jdk18u/src/hotspot/cpu/x86/assembler_x86.cpp:11128:38: error: 'this'
pointer is null [-Werror=nonnull]
11128 | int encode = vex_prefix_and_encode(xmm0->encoding(), dst->encoding(),
src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
| ^~~~
In file included from /usr/src/jdk18u/src/hotspot/share/asm/register.hpp:59,
from /usr/src/jdk18u/src/hotspot/share/asm/assembler.hpp:29,
from /usr/src/jdk18u/src/hotspot/cpu/x86/assembler_x86.cpp:26:
/usr/src/jdk18u/src/hotspot/cpu/x86/register_x86.hpp:160:9: note: in a call to
non-static member function 'int XMMRegisterImpl::encoding() const'
160 | int encoding() const { assert(is_valid(),
"invalid register (%d)", (int)(intptr_t)this ); return (intptr_t)this; }
| ^~~~~~~~
/usr/src/jdk18u/src/hotspot/cpu/x86/assembler_x86.cpp: In member function 'void
Assembler::evprorq(XMMRegister, KRegister, XMMRegister, int, bool, int)':
/usr/src/jdk18u/src/hotspot/cpu/x86/assembler_x86.cpp:11140:38: error: 'this'
pointer is null [-Werror=nonnull]
11140 | int encode = vex_prefix_and_encode(xmm0->encoding(), dst->encoding(),
src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
| ^~~~
In file included from /usr/src/jdk18u/src/hotspot/share/asm/register.hpp:59,
from /usr/src/jdk18u/src/hotspot/share/asm/assembler.hpp:29,
from /usr/src/jdk18u/src/hotspot/cpu/x86/assembler_x86.cpp:26:
/usr/src/jdk18u/src/hotspot/cpu/x86/register_x86.hpp:160:9: note: in a call to
non-static member function 'int XMMRegisterImpl::encoding() const'
160 | int encoding() const { assert(is_valid(),
"invalid register (%d)", (int)(intptr_t)this ); return (intptr_t)this; }
| ^~~~~~~~
Compiling 11 properties into resource bundles for java.base
cc1plus: all warnings being treated as errors
gmake[3]: *** [lib/CompileJvm.gmk:143:
/usr/src/jdk18u/build/linux-x86_64-server-release/hotspot/variant-server/libjvm/objs/assembler_x86.o]
Error 1
gmake[3]: *** Waiting for unfinished jobs....
Compiling 6 properties into resource bundles for java.base
gmake[2]: *** [make/Main.gmk:252: hotspot-server-libs] Error 2
gmake[2]: *** Waiting for unfinished jobs....
ERROR: Build failed for target 'images' in configuration
'linux-x86_64-server-release' (exit code 2)
```
```
cat
/usr/src/jdk18u/build/linux-x86_64-server-release/make-support/failure-logs/*
/usr/bin/g++ -MMD -MF
/usr/src/jdk18u/build/linux-x86_64-server-release/hotspot/variant-server/libjvm/objs/assembler_x86.d.tmp
-I/usr/src/jdk18u/build/linux-x86_64-server-release/hotspot/variant-server/libjvm/objs/precompiled
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
-D_GNU_SOURCE -D_REENTRANT -pipe -fno-rtti -fno-exceptions -fvisibility=hidden
-fno-strict-aliasing -fno-omit-frame-pointer -fcheck-new -fstack-protector
-std=c++14 -DLIBC=gnu -DLINUX -Wall -Wextra -Wformat=2 -Wpointer-arith
-Wsign-compare -Wunused-function -Wundef -Wunused-value -Wreturn-type
-Wtrampolines -Woverloaded-virtual -Wreorder -fPIC
-fmacro-prefix-map=/usr/src/jdk18u/= -DVM_LITTLE_ENDIAN -D_LP64=1
-fno-delete-null-pointer-checks -fno-lifetime-dse -Wno-format-zero-length
-Wtype-limits -Wuninitialized -m64 -DPRODUCT -DTARGET_ARCH_x86
-DINCLUDE_SUFFIX_OS=_linux -DINCLUDE_SUFFIX_CPU=_x86
-DINCLUDE_SUFFIX_COMPILER=_gcc -DTARGET_COMPILER_gcc -DAMD64
-DHOTSPOT_LIB_ARCH='"amd64"' -DCOMPILER1 -DCOMPILER2
-I/usr/src/jdk18u/build/linux-x86_64-server-release/hotspot/variant-server/gensrc/adfiles
-I/usr/src/jdk18u/src/hotspot/share -I/usr/src/jdk18u/src/hotspot/os/linux
-I/usr/src/jdk18u/src/hotspot/os/posix -I/usr/src/jdk18u/src/hotspot/cpu/x86
-I/usr/src/jdk18u/src/hotspot/os_cpu/linux_x86
-I/usr/src/jdk18u/build/linux-x86_64-server-release/hotspot/variant-server/gensrc
-I/usr/src/jdk18u/src/hotspot/share/precompiled
-I/usr/src/jdk18u/src/hotspot/share/include
-I/usr/src/jdk18u/src/hotspot/os/posix/include
-I/usr/src/jdk18u/build/linux-x86_64-server-release/support/modules_include/java.base
-I/usr/src/jdk18u/build/linux-x86_64-server-release/support/modules_include/java.base/linux
-I/usr/src/jdk18u/src/java.base/share/native/libjimage -m64
-I/usr/src/jdk18u/build/linux-x86_64-server-release/hotspot/variant-server/gensrc/adfiles
-I/usr/src/jdk18u/src/hotspot/share -I/usr/src/jdk18u/src/hotspot/os/linux
-I/usr/src/jdk18u/src/hotspot/os/posix -I/usr/src/jdk18u/src/hotspot/cpu/x86
-I/usr/src/jdk18u/src/hotspot/os_cpu/linux_x86
-I/usr/src/jdk18u/build/linux-x86_64-server-release/hotspot/variant-server/gensrc
-Wno-unused-parameter -Wno-unused -Wno-parentheses -Wno-comment
-Wno-unknown-pragmas -Wno-address -Wno-delete-non-virtual-dtor
-Wno-char-subscripts -Wno-array-bounds -Wno-int-in-bool-context
-Wno-ignored-qualifiers -Wno-missing-field-initializers
-Wno-implicit-fallthrough -Wno-empty-body -Wno-strict-overflow
-Wno-sequence-point -Wno-maybe-uninitialized -Wno-misleading-indentation
-Wno-cast-function-type -Wno-shift-negative-value -Werror -O3
-Wno-maybe-uninitialized -c -o
/usr/src/jdk18u/build/linux-x86_64-server-release/hotspot/variant-server/libjvm/objs/assembler_x86.o
/usr/src/jdk18u/src/hotspot/cpu/x86/assembler_x86.cpp
/usr/src/jdk18u/src/hotspot/cpu/x86/assembler_x86.cpp: In member function 'void
Assembler::evprord(XMMRegister, KRegister, XMMRegister, int, bool, int)':
/usr/src/jdk18u/src/hotspot/cpu/x86/assembler_x86.cpp:11128:38: error: 'this'
pointer is null [-Werror=nonnull]
11128 | int encode = vex_prefix_and_encode(xmm0->encoding(), dst->encoding(),
src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
| ^~~~
In file included from /usr/src/jdk18u/src/hotspot/share/asm/register.hpp:59,
from /usr/src/jdk18u/src/hotspot/share/asm/assembler.hpp:29,
from /usr/src/jdk18u/src/hotspot/cpu/x86/assembler_x86.cpp:26:
/usr/src/jdk18u/src/hotspot/cpu/x86/register_x86.hpp:160:9: note: in a call to
non-static member function 'int XMMRegisterImpl::encoding() const'
160 | int encoding() const { assert(is_valid(),
"invalid register (%d)", (int)(intptr_t)this ); return (intptr_t)this; }
| ^~~~~~~~
/usr/src/jdk18u/src/hotspot/cpu/x86/assembler_x86.cpp: In member function 'void
Assembler::evprorq(XMMRegister, KRegister, XMMRegister, int, bool, int)':
/usr/src/jdk18u/src/hotspot/cpu/x86/assembler_x86.cpp:11140:38: error: 'this'
pointer is null [-Werror=nonnull]
11140 | int encode = vex_prefix_and_encode(xmm0->encoding(), dst->encoding(),
src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
| ^~~~
In file included from /usr/src/jdk18u/src/hotspot/share/asm/register.hpp:59,
from /usr/src/jdk18u/src/hotspot/share/asm/assembler.hpp:29,
from /usr/src/jdk18u/src/hotspot/cpu/x86/assembler_x86.cpp:26:
/usr/src/jdk18u/src/hotspot/cpu/x86/register_x86.hpp:160:9: note: in a call to
non-static member function 'int XMMRegisterImpl::encoding() const'
160 | int encoding() const { assert(is_valid(),
"invalid register (%d)", (int)(intptr_t)this ); return (intptr_t)this; }
| ^~~~~~~~
cc1plus: all warnings being treated as errors
```
Has anyone tried compiling this on RHEL9 or Fedora >= 34 / GCC >= 11.3.1?
Does anyone know of a workaround to get this to compile on these platforms/with
these compilers?