Red Hat Bugzilla – Bug 240720
gcj generates bad native code for scala
Last modified: 2007-11-30 17:12:04 EST
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):
Steps to Reproduce:
1. Download the scala runtime from
2. Extract runtime to a new directory
3. Run the following from that directory:
aot-compile -c -g share/scala/lib share/scala/lib-native
gcj-dbtool -m scala.gcjdb `gcj-dbtool -p` share/scala/lib-native/*.db
The scala interpreter banner and prompt
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
Created attachment 155072 [details]
Stack trace and other gdb post-mortem
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.
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.
Created attachment 155426 [details]
a small test case that triggers this bug
Patch at http://gcc.gnu.org/ml/java-patches/2007-q2/msg00252.html
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?
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.