RFR: 8374448: SIGSEGV in ConstantPool::print_value_on with -XX:CompileCommand=print [v2]
Johan Sjölen
jsjolen at openjdk.org
Thu Feb 12 08:46:37 UTC 2026
On Thu, 12 Feb 2026 08:09:11 GMT, Dmitry Chuyko <dchuyko at openjdk.org> wrote:
> Just in case, GCC (Red Hat 8.5.0-23) still issues warnings related to the same change, like following:
>
> ```
> src/hotspot/share/oops/bsmAttribute.hpp: In member function ‘const Array<unsigned int>* const& BSMAttributeEntries::offsets() const’:
> src/hotspot/share/oops/bsmAttribute.hpp:135:52: warning: returning reference to temporary [-Wreturn-local-addr]
> const Array<u4>* const& offsets() const { return _offsets; }
> ^~~~~~~~
> src/hotspot/share/oops/bsmAttribute.hpp: In member function ‘const Array<short unsigned int>* const& BSMAttributeEntries::bootstrap_methods() const’:
> src/hotspot/share/oops/bsmAttribute.hpp:137:62: warning: returning reference to temporary [-Wreturn-local-addr]
> const Array<u2>* const& bootstrap_methods() const { return _bootstrap_methods; }
> ```
Oh, I think you guys are using broken compilers and this is why the JVM crashes. Look at this: https://godbolt.org/z/9YGs51dGT
If your compiler is misbehaving in the same way that Godbolt's 8.3 is doing, then it actually returns a null pointer. Gcc 14.2 behaves as expected.
The warning is incorrect, as it's meant to return a reference to the member, not a reference to a temporary.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/29611#issuecomment-3889513747
More information about the hotspot-dev
mailing list