This is the mail archive of the
java-prs@sources.redhat.com
mailing list for the Java project.
gcj/367: Compiler problem with LinkedList iterator
- To: java-gnats at sourceware dot cygnus dot com
- Subject: gcj/367: Compiler problem with LinkedList iterator
- From: bryce at albatross dot co dot nz
- Date: 3 Nov 2000 04:47:01 -0000
- Reply-To: bryce at albatross dot co dot nz
- Resent-Cc: java-prs at sourceware dot cygnus dot com, green at cygnus dot com
- Resent-Reply-To: java-gnats@sourceware.cygnus.com, bryce@albatross.co.nz
>Number: 367
>Category: gcj
>Synopsis: Compiler problem with LinkedList iterator
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: apbianco
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Nov 02 20:50:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator: Bryce McKinlay
>Release: recent 2.97
>Organization:
>Environment:
>Description:
gcj apparantly miscompiles LinkedList.java.
The following test case will crash mysteriously:
import java.util.*;
public class LLTest
{
public static void main(String[] args)
{
List l = new LinkedList();
l.add("one");
l.add("two");
ListIterator i = l.listIterator();
i.next();
i.remove();
System.out.println(i.next());
}
}
Program received signal SIGSEGV, Segmentation fault.
0x4014be6b in java.util.LinkedList.removeEntry (this=@8069289, e=@8069270)
at ../../../libjava/java/util/LinkedList.java:133
warning: Source file is more recent than executable.
133 e.previous.next = e.next;
Current language: auto; currently java
(gdb) bt
#0 0x4014be6b in java.util.LinkedList.removeEntry (this=@8069289, e=@8069270)
at ../../../libjava/java/util/LinkedList.java:133
#1 0x4014bae8 in java.util.LinkedList$LinkedListItr.remove (this=@8066ae0)
at ../../../libjava/java/util/LinkedList.java:631
#2 0x804bb25 in LLTest.main (args=@4020ffc0) at LLTest.java:13
#3 0x400ee087 in gnu::gcj::runtime::FirstThread::run (this=@8067ea0)
at ../../../libjava/gnu/gcj/runtime/natFirstThread.cc:146
#4 0x400f8df6 in java::lang::Thread::run_ (obj=@8067ea0)
at ../../../libjava/java/lang/natThread.cc:263
#5 0x401aeb11 in really_start (x=@80bcff8)
at ../../../libjava/posix-threads.cc:344
#6 0x402c8692 in GC_start_routine (arg=@8081fc0)
at ../../../boehm-gc/linux_threads.c:631
#7 0x402e0b85 in pthread_start_thread (arg=@bf7ffe40) at manager.c:241
It appears that an incorrect "this" is passed to
LinkedList.removeEntry() from LinkedListItr.remove(),
resulting in the wrong code to be executed inside that
method.
This seems similar to the "Hashtable" bug, PR 332.
>How-To-Repeat:
Try to run the above test case on the latest libgcj
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: