SegFault in jc1 of ss-20001211

Martin Kahlert martin.kahlert@infineon.com
Thu Dec 14 08:05:00 GMT 2000


Hi!
I think i found a bug in jc1 (gcc-20001211)
Ok, i know it's a bug, but i think i found the reason for it :-)

I have a huge collection of .class files and want to compile
them into object files. It works for all of about 1800 files
but 6 on Linux.

I looked into one of them, which produces a seg fault.
I am sorry, that i cannot give you the .class files (even i am
not allowed to see the corresponding glory huge .java files, 
which were generated)

I debugged a bit and this showed up:
get_constant produces a CONSTANT_Long and sets its CONSTANT_ResolvedFlag.
The next calls of get_constant for this constant are returned
by the lines

if ((tag & CONSTANT_ResolvedFlag) || tag == CONSTANT_Utf8)
    return (tree) jcf->cpool.data[index];

Then somebody (poison_pages?) changes the TREE_TYPE into 0xa5a5a5a5
Stack trace:
#0  0x400760c6 in memset () at ../sysdeps/i386/memset.c:80
#1  0x829a4eb in ggc_collect () at ../../gcc/ggc-page.c:1108
#2  0x80afc00 in rest_of_compilation (decl=0x4014b080) at ../../gcc/toplev.c:2867
#3  0x808b8f5 in end_java_method () at ../../gcc/java/decl.c:1882
#4  0x80a07b5 in parse_class_file () at ../../gcc/java/jcf-parse.c:747
#5  0x80a0d93 in yyparse () at ../../gcc/java/jcf-parse.c:921
#6  0x80ae963 in compile_file (name=0x8366fe0 "VHDL/VC/Parser/VCP_Parser_AMSTokenManager.class") at ../../gcc/toplev.c:2374
#7  0x80b3580 in main (argc=3, argv=0xbffff2e4) at ../../gcc/toplev.c:4851

After a cont the seg fault happens.

Stack trace:

0  0x808c330 in push_value (value=0x40550ae0) at ../../gcc/java/expr.c:279
#1  0x8092748 in java_push_constant_from_pool (jcf=0x832a6e0, index=334) at ../../gcc/java/expr.c:2749
#2  0x8092947 in process_jvm_instruction (PC=253, byte_ops=0x8398d34 "§", length=1984) at ../../gcc/java/javaop.def:130
#3  0x8092692 in expand_byte_code (jcf=0x832a6e0, method=0x4014b200) at ../../gcc/java/expr.c:2721
#4  0x80a07ad in parse_class_file () at ../../gcc/java/jcf-parse.c:745
#5  0x80a0d93 in yyparse () at ../../gcc/java/jcf-parse.c:921
#6  0x80ae963 in compile_file (name=0x8366fe0 "VHDL/VC/Parser/VCP_Parser_AMSTokenManager.class") at ../../gcc/toplev.c:2374
#7  0x80b3580 in main (argc=3, argv=0xbffff2e4) at ../../gcc/toplev.c:4851

So the garbage collector seems to mistakenly think we are finished
with that stuff.

I don't have any idea, why this happens, but i assume it happens while we
parse a class file, which needs infos from other class files, so we parse
them too.
If we compile them one after the other perhaps some memory gets lost.

Hope that helps for a good idea,
Martin.


More information about the Gcc-bugs mailing list