Bug 240720 - gcj generates bad native code for scala
gcj generates bad native code for scala
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
i386 Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2007-05-21 01:44 EDT by Geoff Reedy
Modified: 2007-11-30 17:12 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-05-30 11:57:39 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Stack trace and other gdb post-mortem (1.99 KB, text/plain)
2007-05-21 01:44 EDT, Geoff Reedy
no flags Details
a small test case that triggers this bug (4.00 KB, application/zip)
2007-05-25 00:25 EDT, Geoff Reedy
no flags Details

  None (edit)
Description Geoff Reedy 2007-05-21 01:44:06 EDT
Description of problem:

Using aot-compile to build native code versions of scala's compiler and standard
library results in code that sends a class name instead of a class structure to
_Jv_CheckCast which results in a segmentation fault (reported as a

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Download the scala runtime from

2. Extract runtime to a new directory

3. Run the following from that directory:

mkdir share/scala/lib-native
aot-compile -c -g share/scala/lib share/scala/lib-native
gcj-dbtool -m scala.gcjdb `gcj-dbtool -p` share/scala/lib-native/*.db
GCJ_PROPERTIES="gnu.gcj.precompiled.db.path=$PWD/scala.gcjdb" bin/scala 
Actual results:

Segmentation fault

Expected results:

The scala interpreter banner and prompt

Additional info:

In particular the issue seems to be with scala's anonymous functions since the
scala compiler fails in the same way within another anonymous function.

I have attached a stack trace and some additional post-mortem from gdb
Comment 1 Geoff Reedy 2007-05-21 01:44:06 EDT
Created attachment 155072 [details]
Stack trace and other gdb post-mortem
Comment 2 Geoff Reedy 2007-05-21 01:48:03 EDT
Also, I have been unable to generate a smaller test case or one that involves
vanilla java code.  I'll keep trying and add it here if I am successful.
Comment 3 Geoff Reedy 2007-05-25 00:10:19 EDT
I've managed to get together a more minimal test case that doesn't involve scala
at all.  It wasn't generated from java source but through jasmin and some binary
edits to the class files to mimic the files generated by the scala compiler
(setting the access flags of test$$anonfun$0 to public synthetic final). I'll be
attaching a zip file with these classes momentarily.
Comment 4 Geoff Reedy 2007-05-25 00:25:57 EDT
Created attachment 155426 [details]
a small test case that triggers this bug
Comment 5 Andrew Haley 2007-05-30 11:56:13 EDT
Patch at http://gcc.gnu.org/ml/java-patches/2007-q2/msg00252.html
Comment 6 Geoff Reedy 2007-05-30 22:53:02 EDT
Thanks for the quick resolution of this issue!  Seeing as fc7 is scheduled for release tomorrow I 
understand the fix won't make it in.  Will the patch be in an update for fc7 shortly?
Comment 7 Jakub Jelinek 2007-05-31 03:26:39 EDT
It will make it into Fedora 8 development soon (and the packages will be usable
even in F7).  It will make it into F7 updates after some time, depends what
shortly means for you.  It certainly won't be shorter than a month or two,
releasing a huge gcc update just to fix one or two bugs, unless they are show
stoppers for many people, is just way too bandwidth unfriendly for all people
that would need to download it.

Note You need to log in before you can comment on or make changes to this bug.