public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/18697] New: Miscompilation of GtkMenuItemPeer.setParent(MenuItem)
@ 2004-11-27 23:59 mark at gcc dot gnu dot org
  2004-11-28  0:05 ` [Bug java/18697] " pinskia at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: mark at gcc dot gnu dot org @ 2004-11-27 23:59 UTC (permalink / raw)
  To: gcc-bugs

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=18697


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2004-12-04  4:04 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-27 23:59 [Bug java/18697] New: Miscompilation of GtkMenuItemPeer.setParent(MenuItem) mark at gcc dot gnu dot org
2004-11-28  0:05 ` [Bug java/18697] " pinskia at gcc dot gnu dot org
2004-11-28  0:10 ` mark at gcc dot gnu dot org
2004-11-28  0:10 ` [Bug java/18697] [4.0 Regression] " pinskia at gcc dot gnu dot org
2004-11-28 12:41 ` mark at gcc dot gnu dot org
2004-11-28 12:59 ` aph at gcc dot gnu dot org
2004-11-28 13:29 ` mark at gcc dot gnu dot org
2004-11-29 14:17 ` pinskia at gcc dot gnu dot org
2004-12-02 19:32 ` aph at gcc dot gnu dot org
2004-12-03 18:02 ` cvs-commit at gcc dot gnu dot org
2004-12-03 23:33 ` tromey at gcc dot gnu dot org
2004-12-04  4:04 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).