The setParent(MenuItem) method in gnu/java/awt/peer/gtk/GtkMenuItemPeer.java gets miscompiled which makes Menu related tests in the Mauve Visual Test Engine and the AWT demo from GNU Classpath examples crash.
Example (from GNU Classpath 0.12 examples): gij -cp examples.zip gnu.classpath.examples.awt.Demo Aborted A gdb shows the following (impossible!) backtrace: #0 0x0eee3144 in Java_gnu_java_awt_peer_gtk_GtkMenuPeer_delItem (env=Variable "env" is not available. ) at /home/mark/src/gcc40/gcc/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c:164 #1 0x0eee3140 in Java_gnu_java_awt_peer_gtk_GtkMenuPeer_delItem (env=Variable "env" is not available.) at /home/mark/src/gcc40/gcc/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c:164 #2 0x0eecddf4 in gnu.java.awt.peer.gtk.GtkMenuItemPeer.setParent(java.awt.MenuItem) (this=Variable "this" is not available.) at /home/mark/src/gcc40/gcc/libjava/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java:78 #3 0x0eecdc30 in gnu.java.awt.peer.gtk.GtkMenuItemPeer.GtkMenuItemPeer(java.awt.MenuItem) (this=Variable "this" is not available.) at /home/mark/src/gcc40/gcc/libjava/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java:60 #4 0x0eece410 in gnu.java.awt.peer.gtk.GtkMenuPeer.GtkMenuPeer(java.awt.Menu) (this=Variable "this" is not available.) at /home/mark/src/gcc40/gcc/libjava/gnu/java/awt/peer/gtk/GtkMenuPeer.java:58 #5 0x0eed3ab8 in gnu.java.awt.peer.gtk.GtkToolkit.createMenu(java.awt.Menu) (this=Variable "this" is not available.) at /home/mark/src/gcc40/gcc/libjava/gnu/java/awt/peer/gtk/GtkToolkit.java:446 [...] This has nothing to do with the recent gui-merge patch. It works fine when compiled with the gui branch compiler and fails in exactly the same why before and after the gui-branch-merge-patch in the trunk. It fails in the same way on i686-pc-linux-gnu and powerpc-unknown-linux-gnu (both configured with --enable-java-awt=gtk,xlib) gij (GNU libgcj) version 4.0.0 20041127 (experimental) The following rewrite of the method makes everything work fine. --- gnu/java/awt/peer/gtk/GtkMenuItemPeer.java 2 Sep 2004 05:10:11 -0000 1.5 +++ gnu/java/awt/peer/gtk/GtkMenuItemPeer.java 26 Nov 2004 04:47:09 -0000 @@ -74,8 +97,10 @@ } else // parent instanceof Menu { - ((GtkMenuPeer)((Menu)parent).getPeer ()).addItem (this, - item.getShortcut ()); + Menu m = (Menu) parent; + GtkMenuPeer gmp = (GtkMenuPeer) m.getPeer(); + MenuShortcut ms = item.getShortcut(); + gmp.addItem(this, ms); } } See also http://gcc.gnu.org/ml/java-patches/2004-q4/msg00736.html -- Summary: Miscompilation of GtkMenuItemPeer.setParent(MenuItem) Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: java AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: mark at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18696