Bug 12257

Summary: Inner classes with same name causes crash.
Product: gcc Reporter: Ralph Loader <suckfish>
Component: javaAssignee: Andrew Haley <aph>
Status: RESOLVED FIXED    
Severity: normal CC: gcc-bugs, java-prs
Priority: P2 Keywords: ice-on-valid-code
Version: 3.3.1   
Target Milestone: 4.3.0   
Host: redhat-pc-linux Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2006-01-18 00:31:06
Bug Depends on: 24442, 28067    
Bug Blocks: 18131    

Description Ralph Loader 2003-09-12 00:11:21 UTC
/* The following code causes gcj-3.3.1 to segfault.
 *
 * Two overloaded methods with the same name, each containing an inner
 * class with the same name.

$ cat /etc/redhat-release
Raw Hide 20030906

$ rpm -q gcc-java
gcc-java-3.3.1-3

$ gcj --version
gcj (GCC) 3.3.1 20030903 (Red Hat Linux 3.3.1-3)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gcj -C E.java
E.java: In class `S.E':
E.java: In method `S.E.C()':
E.java:13: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla> for instructions.

 */

package S;

class E {
    void C ()
    {
	class I { };
	new I();
    }

    void C (final int J)
    {
 	class I { };
    }

}
Comment 1 Tom Tromey 2003-09-12 14:51:59 UTC
Also fails with current cvs head
Comment 2 Andrew Pinski 2003-12-26 23:26:07 UTC
Here is the backtrace:

0x0807fca5 in patch_method_invocation (patch=0x4004c340, primary=0x0, where=0x0, 
from_super=1, is_static=0x0, ret_decl=0xbffebe98)
    at parse.y:10752
10752       if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta))) &&
(gdb) bt
#0  0x0807fca5 in patch_method_invocation (patch=0x4004c340, primary=0x0, where=
0x0, from_super=1, is_static=0x0, 
    ret_decl=0xbffebe98) at parse.y:10752
#1  0x08072c54 in java_complete_lhs (node=0x4004c340) at parse.y:11906
#2  0x0807d17c in java_complete_tree (node=0x4004c340) at parse.y:11424
#3  0x08072659 in java_complete_lhs (node=0x4004c360) at parse.y:11822
#4  0x0807d17c in java_complete_tree (node=0x400c3384) at parse.y:11424
#5  0x08077221 in java_complete_lhs (node=0x400c3370) at parse.y:11545
#6  0x0807d17c in java_complete_tree (node=0x0) at parse.y:11424
#7  0x0807d3e7 in java_complete_expand_method (mdecl=0x400c1a20) at 
parse.y:8046
#8  0x0807dfaf in java_complete_expand_class (outer=0x400c1804) at parse.y:7761
#9  0x0807e9bc in java_expand_classes () at parse.y:7662
#10 0x080bb5a3 in java_parse_file (set_yydebug=0) at /home/gates/pinskia/src/gnu/gcc/
src/gcc/java/jcf-parse.c:1112
#11 0x082f68fd in toplev_main (argc=1, argv=0xbffec5a3) at /home/gates/pinskia/src/
gnu/gcc/src/gcc/toplev.c:1804
#12 0x080d250e in main (argc=1, argv=0x1) at /home/gates/pinskia/src/gnu/gcc/src/gcc/
main.c:35
Comment 3 Andrew Haley 2006-05-10 17:41:33 UTC
Xref: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=191211
Comment 4 Tom Tromey 2007-01-09 20:45:48 UTC
All gcj front end bugs have been fixed by the gcj-eclipse branch merge.
I'm mass-closing the affected PRs.
If you believe one of these was closed in error, please reopen it
with a note explaining why.
Thanks.