This is the mail archive of the java-discuss@sourceware.cygnus.com 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]

Current libgcj tree has big problems with arrays -- interpreter related?


libgcj has recently developed some serious problems relating to array
instantiation and assignment. I've already posted a bug-report about this
(libgcj/35), but I've found another test case that seems to be similar. I'm not
sure exactly when these problems started, but I'm guessing its related to the
inclusion of the interpreter (apologies to Kresten & Anthony if I'm pointing the
finger of blame in the wrong direction).

I don't think this is a compiler problem since changing to older compiler builds
doesn't fix the problem, but using a pre-interpreter libgcj build does.
Configuring without "--enable-interpreter" does not fix the problem, but
interestingly the problems do not occur when using "gij".

Here are two test cases that seem to be similar-but-different (the first one is
already checked in to cvs in the test suite):

public class Array_2
{
  static final int a = 10, b = 15;

  public static void main(String args[])
  {
    int[][] foo = new int [a][b];
    System.out.println(foo.length);
    System.out.println(foo[a-1].length);
  }
}


./Array_2

uncaught exception at top level
java.lang.NullPointerException

(gdb) r
Starting program:
/home/bryce/projects/libgcj/libjava/testsuite/libjava.lang/./Array_2
[New Thread 3820]
[New Thread 3819]
[New Thread 3821]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 3821]

Program received signal SIGSEGV, Segmentation fault.
0x40108645 in java::lang::Class::isArray (this=0x804dc6e)
    at ../../../libjava/java/lang/Class.h:121
121           return name->data[0] == '[';
Current language:  auto; currently c++
(gdb) bt
#0  0x40108645 in java::lang::Class::isArray (this=0x804dc6e)
    at ../../../libjava/java/lang/Class.h:121
#1  0x40093d30 in _Jv_NewMultiArray (array_type=0x804dc6e, dimensions=2)
    at ../../../libjava/java/lang/Class.h:78
#2  0x40093e2c in _Jv_NewMultiArray () at ../../../libjava/prims.cc:457
#3  0x804ad27 in Array_2::main (args=0x806fff0) at Array_2.java:7
#4  0x40109e0a in java::lang::FirstThread::run0 (this=0x8067f90)
    at ../../../libjava/java/lang/natFirstThread.cc:66
#5  0x400c35f4 in java::lang::FirstThread::run (this=0x8067f90)
    at ../../../libjava/java/lang/FirstThread.java:26
#6  0x400cd5d6 in java::lang::Thread::run_ (this=0x8067f90)
    at ../../../libjava/java/lang/Thread.java:119
#7  0x4010e4d6 in java::lang::Thread::run__ (obj=0x8067f90)
    at ../../../libjava/java/lang/natThread.cc:257
#8  0x4011e471 in really_start (x=0x8062ef0)
    at ../../../libjava/posix-threads.cc:289
#9  0x401c5846 in GC_start_routine (arg=0x8085fe0)
    at ../../../boehm-gc/linux_threads.c:539
#10 0x401dcce9 in pthread_start_thread (arg=0xbf7ffe7c) at manager.c:204

And test case #2:

import java.text.DecimalFormat;

public class Format1
{
  public static void main(String args[])
  {
    DecimalFormat df = new DecimalFormat();
  }
}

[bryce@reason tests]$ gdb ./format1
GNU gdb 4.17.0.11 with Linux support
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i586-pc-linux"...
(gdb) r
Starting program: /home/bryce/projects/tests/./format1
[New Thread 22655]
[New Thread 22654]
[New Thread 22656]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 22656]

Program received signal SIGSEGV, Segmentation fault.
0x400fe536 in _Jv_FindArrayClass (element=0x40116234, loader=0x0)
    at ../../../libjava/java/lang/natClassLoader.cc:545
545         len = element->name->length + 5;
Current language:  auto; currently c++
(gdb) bt
#0  0x400fe536 in _Jv_FindArrayClass (element=0x40116234, loader=0x0)
    at ../../../libjava/java/lang/natClassLoader.cc:545
#1  0x400922d5 in _Jv_NewObjectArray (count=9, elementClass=0x40116234,
    init=0x0) at ../../../libjava/prims.cc:321
#2  0x4009b15e in gnu::gcj::text::LocaleData_en_US::_003cclinit_003e ()
    at ../../../libjava/gnu/gcj/text/LocaleData_en_US.java:23
#3  0x400fd744 in java::lang::Class::hackRunInitializers (this=0x40139900)
    at ../../../libjava/java/lang/natClass.cc:381
#4  0x400fa764 in java::lang::Class::hackTrampoline (this=0x40139900, what=1,
    old_exception=0x0) at ../../../libjava/java/lang/Class.java:137
#5  0x400fd89d in java::lang::Class::initializeClass (this=0x40139900)
    at ../../../libjava/java/lang/natClass.cc:466
#6  0x400fdd02 in _Jv_InitClass (klass=0x40139900)
    at ../../../libjava/java/lang/natClass.cc:610
#7  0x400fcdd0 in java::lang::Class::forName (className=0x8069a98)
    at ../../../libjava/java/lang/natClass.cc:95
#8  0x400ef693 in java::util::ResourceBundle::trySomeGetBundle (
    bundleName=0x8069a98, stopHere=0x8069a68)
    at ../../../libjava/java/util/ResourceBundle.java:77
#9  0x400efa8f in java::util::ResourceBundle::partialGetBundle (
    baseName=0x8068e60, locale=0x8069c18, langStop=false)
    at ../../../libjava/java/util/ResourceBundle.java:145
#10 0x400efc0c in java::util::ResourceBundle::getBundle (baseName=0x8068e60,
    locale=0x8069c18) at ../../../libjava/java/util/ResourceBundle.java:162
#11 0x400dc4e6 in java::text::DecimalFormatSymbols::DecimalFormatSymbols (
    this=0x8067de0, loc=0x8069c18)
    at ../../../libjava/java/text/DecimalFormatSymbols.java:96
#12 0x400d7fc0 in java::text::DecimalFormat::_003cclinit_003e ()
    at ../../../libjava/java/text/DecimalFormat.java:985
#13 0x400fd744 in java::lang::Class::hackRunInitializers (this=0x80502c0)
    at ../../../libjava/java/lang/natClass.cc:381
#14 0x400fa764 in java::lang::Class::hackTrampoline (this=0x80502c0, what=1,
    old_exception=0x0) at ../../../libjava/java/lang/Class.java:137
#15 0x400fd89d in java::lang::Class::initializeClass (this=0x80502c0)
    at ../../../libjava/java/lang/natClass.cc:466
#16 0x400fdd02 in _Jv_InitClass (klass=0x80502c0)
    at ../../../libjava/java/lang/natClass.cc:610
---Type <return> to continue, or q <return> to quit---
#17 0x40092203 in _Jv_AllocObject (c=0x80502c0, size=64)
    at ../../../libjava/prims.cc:285
#18 0x804acc5 in Format1::main (args=0x806fff0) at Format1.java:7
#19 0x400ff3fa in java::lang::FirstThread::run0 (this=0x8067f90)
    at ../../../libjava/java/lang/natFirstThread.cc:66
#20 0x400b8db4 in java::lang::FirstThread::run (this=0x8067f90)
    at ../../../libjava/java/lang/FirstThread.java:26
#21 0x400c2d96 in java::lang::Thread::run_ (this=0x8067f90)
    at ../../../libjava/java/lang/Thread.java:119
#22 0x40103ac6 in java::lang::Thread::run__ (obj=0x8067f90)
    at ../../../libjava/java/lang/natThread.cc:257
#23 0x40113391 in really_start (x=0x8062f30)
    at ../../../libjava/posix-threads.cc:289
#24 0x401b9846 in GC_start_routine (arg=0x8085fe0)
    at ../../../boehm-gc/linux_threads.c:539
#25 0x401d0ce9 in pthread_start_thread (arg=0xbf7ffe7c) at manager.c:20

regards

  [ bryce ]



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