https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91855

            Bug ID: 91855
           Summary: [8/9 Regression] OpenJDK Zero VM segfaults on SPARC
           Product: gcc
           Version: 9.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: glaubitz at physik dot fu-berlin.de
                CC: ebotcazou at gcc dot gnu.org, jrtc27 at jrtc27 dot com,
                    matorola at gmail dot com
  Target Milestone: ---
            Target: sparc*-*-*

Building the Zero VM (interpreter-type VM) of OpenJDK on SPARC with gcc-8 or
gcc-9 results in the virtual machine segfaulting with:

glaubitz@gcc202:~/openjdk-test/jdk11u-046604d257d7$ gdb
./build/linux-sparcv9-normal-zero-release/jdk/bin/java
GNU gdb (Debian 8.3-1) 8.3
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "sparc64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./build/linux-sparcv9-normal-zero-release/jdk/bin/java...
(No debugging symbols found in
./build/linux-sparcv9-normal-zero-release/jdk/bin/java)
(gdb) r
Starting program:
/home/glaubitz/openjdk-test/jdk11u-046604d257d7/build/linux-sparcv9-normal-zero-release/jdk/bin/java
 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/sparc64-linux-gnu/libthread_db.so.1".
[New Thread 0xfff8000101379900 (LWP 41760)]

Thread 2 "java" received signal SIGBUS, Bus error.
[Switching to Thread 0xfff8000101379900 (LWP 41760)]
0xfff8000100c81098 in SharedRuntime::generate_stubs ()
    at
/home/glaubitz/openjdk-test/jdk11u-046604d257d7/src/hotspot/share/runtime/sharedRuntime.cpp:106
106       _resolve_static_call_blob            =
generate_resolve_blob(CAST_FROM_FN_PTR(address,
SharedRuntime::resolve_static_call_C),        "resolve_static_call");
(gdb) bt
#0  0xfff8000100c81098 in SharedRuntime::generate_stubs ()
    at
/home/glaubitz/openjdk-test/jdk11u-046604d257d7/src/hotspot/share/runtime/sharedRuntime.cpp:106
#1  0xfff8000100a570e8 in init_globals ()
    at
/home/glaubitz/openjdk-test/jdk11u-046604d257d7/src/hotspot/share/runtime/init.cpp:122
#2  0xfff8000100ccebd0 in Threads::create_vm (args=<optimized out>,
canTryAgain=0xfff8000101378c2f)
    at
/home/glaubitz/openjdk-test/jdk11u-046604d257d7/src/hotspot/share/runtime/thread.cpp:3732
#3  0xfff8000100a9d064 in JNI_CreateJavaVM_inner (args=0xfff8000101378d58,
penv=0xfff8000101378d50, 
    vm=0xfff8000101378d48)
    at
/home/glaubitz/openjdk-test/jdk11u-046604d257d7/src/hotspot/share/prims/jni.cpp:3954
#4  JNI_CreateJavaVM (vm=0xfff8000101378d48, penv=0xfff8000101378d50,
args=0xfff8000101378d58)
    at
/home/glaubitz/openjdk-test/jdk11u-046604d257d7/src/hotspot/share/prims/jni.cpp:4045
#5  0xfff800010036ba88 in InitializeJVM (ifn=<synthetic pointer>,
penv=0xfff8000101378d50, 
    pvm=0xfff8000101378d48)
    at
/home/glaubitz/openjdk-test/jdk11u-046604d257d7/src/java.base/share/native/libjli/java.c:1527
#6  JavaMain (_args=<optimized out>)
    at
/home/glaubitz/openjdk-test/jdk11u-046604d257d7/src/java.base/share/native/libjli/java.c:414
#7  0xfff8000100251010 in start_thread (arg=0xfff8000101379900) at
pthread_create.c:486
#8  0xfff8000100672154 in __thread_start () at
../sysdeps/unix/sysv/linux/sparc/sparc64/clone.S:78
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)

This can be reproduced on gcc202 with:

$ mkdir openjdk
$ cd openjdk
$ wget https://hg.openjdk.java.net/jdk-updates/jdk11u/archive/tip.zip
$ unzip tip.zip
$ cd jdk11u-*
$ export CC=gcc-9 ; export CXX=g++-9 ; CONF=linux-sparcv9-normal-zero-release
MAKE_VERBOSE=y QUIETLY= LOG=debug make clean CONF=linux-sparcv9-zero-release ;
sh ./configure --with-jvm-variants=zero
--with-boot-jdk=/usr/lib/jvm/java-11-openjdk-sparc64/
--disable-precompiled-headers --disable-warnings-as-errors && make JOBS=64
MAKE_VERBOSE=y QUIETLY= LOG=debug CONF=linux-sparcv9-normal-zero-release
$ ./build/linux-sparcv9-normal-zero-release/jdk/bin/java
Segmentation fault
$

Setting CC=gcc-7 and CXX=g++-7 fixes the problem, so it must be a regression
with gcc-8 and gcc-9.

Reply via email to