This is the mail archive of the java-prs@sources.redhat.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]

gcj/367: Compiler problem with LinkedList iterator



>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:

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