This is the mail archive of the java-prs@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

java/2598: Runtime crash regression accessing field from enclosing class from inner class



>Number:         2598
>Category:       java
>Synopsis:       Runtime crash regression accessing field from enclosing class from inner class
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 20 00:06:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Bryce McKinlay
>Release:        Current 3.0 branch and 3.1 trunk
>Organization:
>Environment:

>Description:
The test case below crashes. This is a recent regression
which seems to be caused by this patch:

2001-04-04  Alexandre Petit-Bianco  <apbianco@redhat.com>

	* java-tree.h (struct lang_decl): New macro
	`DECL_FIXED_CONSTRUCTOR_P.' New field `fixed_ctor.'
	* parse.y (build_instance_initializer): New function.
	(add_instance_initializer): Use it.
	(java_fix_constructors): Set `current_class' before fix pass.
	(fix_constructors): Just return if already fixed. Move `super()'
	invokation ahead. Use `build_instance_initializer.'
	Fixes PR java/1315.

The problem occurs on both the branch and trunk and it breaks 
the collections classes. 

Removing the empty constuctor from the test case causes it
to run correctly.

I can't find anything obviously wrong with the 1315 patch,
perhaps the real problem is not with fix_constructors but
with generate_finit(). It seems that the params list in
generate_finit() never includes the enclosing this param
(this$0), even under the previously working code. Perhaps
it is just co-incidental that this every worked.

Note the lack of a this$0 argument to finit in the stack 
trace:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1026 (runnable)]
0x08048a69 in EnclField__U24_Foo.finit__U24_() (this=@8061e30)
    at EnclField.java:5
5         public static void main(String[] args)
Current language:  auto; currently java
(gdb) bt
#0  0x08048a69 in EnclField__U24_Foo.finit__U24_() (this=@8061e30)
    at EnclField.java:5  
#1  0x08048a9f in EnclField__U24_Foo.EnclField__U24_Foo(EnclField) (
    this=@8061e30, this$0=@8061e40) at EnclField.java:5
>How-To-Repeat:
public class EnclField
{
  int modCount = 345;
  
  public static void main(String[] args)
  {
    new EnclField().new Foo();
    System.out.println ("ok");
  }

  class Foo
  {
    private int bob = modCount;
    
    Foo()
    { 
    }
  }
}
>Fix:

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]