libgcj/7870: Incorrect constructor invoked in inherited class.

ivg2@cornell.edu ivg2@cornell.edu
Mon Sep 9 12:26:00 GMT 2002


>Number:         7870
>Category:       libgcj
>Synopsis:       Incorrect constructor invoked in inherited class.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 09 12:26:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     ivg2@cornell.edu
>Release:        gij (GNU libgcj) version 3.2 20020822 (Red Hat Linux Rawhide 3.2-4)
>Organization:
>Environment:
Red Hat Rawhide (in sync with server on 9/9/02)
Kernel 2.4.20-pre5 
Athlon XP 1600+ processor
>Description:
Here's the code, compiled correctly, 
works under interpreter: 
gij (GNU libgcj) version 0.0.7
Does not work  under:
gij (GNU libgcj) version 3.2 20020822 (Red Hat Linux Rawhide 3.2-4)

Summarry: It appears that a 0-arg constructor
of base class Frame is called, when a 1-argument
constructor of the derived class SaMSimulatorGUI
is present and should be invoked. 

Java below is a frontend to gij.
gij GUISimulator has precisely the same behavior.

Compiled with: javac.
gcj -C filename has the same effect.
Options: 
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --host=athlon-redhat-linux --with-system-zlib --enable-__cxa_atexit
Thread model: posix

============================================
[phantom@cobra bug]$ ls
GUISimulator.java  IDisplay.java  SaM.java  SaMSimulatorGUI.java

[phantom@cobra bug]$ cat IDisplay.java
interface IDisplay { }

[phantom@cobra bug]$ cat SaM.java
public class SaM { }

[phantom@cobra bug]$ cat GUISimulator.java
public class GUISimulator
{ public static void main(String[] args)
  { IDisplay g = new SaMSimulatorGUI(new SaM()); }  }


[phantom@cobra bug]$ cat SaMSimulatorGUI.java
import java.awt.*;

public class SaMSimulatorGUI extends Frame implements IDisplay { public SaMSimulatorGUI (SaM m) { } }
====================================================
[root@cobra bug]# java GUISimulator        
Exception in thread "main" java.lang.NullPointerException
   at 0x40226296: ?? (??:0)
   at 0xbffff1fc: ?? (??:0)
   at 0x4036695a: java.awt.Component.Component() (/usr/lib/libgcj.so.3)
   at 0x4036a94f: java.awt.Container.Container() (/usr/lib/libgcj.so.3)
   at 0x4037d095: java.awt.Window.Window() (/usr/lib/libgcj.so.3)
   at 0x4036fb54: java.awt.Frame.Frame(java.lang.String) (/usr/lib/libgcj.so.3)
   at 0x4036fb19: java.awt.Frame.Frame() (/usr/lib/libgcj.so.3)
   at 0x403c61bb: ffi_call_SYSV (/usr/lib/libgcj.so.3)
   at 0x403c6185: ffi_raw_call (/usr/lib/libgcj.so.3)
   at 0x4023ad4f: _Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation) (/usr/l                                                               ib/libgcj.so.3)
   at 0x4023b664: _Jv_InterpMethod.run(ffi_cif, void, ffi_raw, _Jv_InterpMethodI                                                               nvocation) (/usr/lib/libgcj.so.3)
   at 0x40238c44: _Jv_InterpMethod.run_normal(ffi_cif, void, ffi_raw, void) (/us                                                               r/lib/libgcj.so.3)
   at 0x403c604c: ?? (??:0)
   at 0x403c61bb: ffi_call_SYSV (/usr/lib/libgcj.so.3)
   at 0x403c6185: ffi_raw_call (/usr/lib/libgcj.so.3)
   at 0x4023ad4f: _Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation) (/usr/l                                                               ib/libgcj.so.3)
   at 0x4023b664: _Jv_InterpMethod.run(ffi_cif, void, ffi_raw, _Jv_InterpMethodI                                                               nvocation) (/usr/lib/libgcj.so.3)
   at 0x40238c44: _Jv_InterpMethod.run_normal(ffi_cif, void, ffi_raw, void) (/us                                                               r/lib/libgcj.so.3)
   at 0x403c604c: ?? (??:0)
   at 0x4024d848: gnu.gcj.runtime.FirstThread.call_main() (/usr/lib/libgcj.so.3)
   at 0x402c76b0: gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.3)
   at 0x4025a00c: _Jv_ThreadRun(java.lang.Thread) (/usr/lib/libgcj.so.3)
   at 0x40227bce: _Jv_RunMain(java.lang.Class, byte const, int, byte const, bool                                                               ean) (/usr/lib/libgcj.so.3)
   at 0x08048921: ?? (??:0)
   at 0x420155e4: ?? (??:0)
   at 0x080486e1: ?? (??:0)
[root@cobra bug]# 
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list