Bug 119175 - [compiler] Wrong pc in the line number table attribute
Summary: [compiler] Wrong pc in the line number table attribute
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-03 11:25 EST by GSMD CLA
Modified: 2006-02-15 09:21 EST (History)
2 users (show)

See Also:


Attachments
code sample which runs into error (4.12 KB, application/zip)
2005-12-06 10:50 EST, GSMD CLA
no flags Details
Proposed fix (1.42 KB, patch)
2005-12-15 10:19 EST, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description GSMD CLA 2005-12-03 11:25:30 EST
While using Eclipse 3.1 and JVM 1.5.0_06 or 1.5.0_05

I get the following error while working in Debugger:

--
public class PaymentDoc
{
//some imports

//some methods

  public String getLinkSaveSql()
  {
    return getPayForInvoicesSQL();
  }

  public String getPayForInvoicesSQL()
  {
    String sql = "";
    //some code
    return sql;
  }
}
--

While trying to use getPayForInvoicesSQL() from method getLinkSaveSql()
I get the following error:

--
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d72dff0, pid=6592, tid=412
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_05-b05 mixed mode)
# Problematic frame:
# V  [jvm.dll+0xedff0]
#
# An error report file with more information is saved as hs_err_pid6592.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#
---

hs_err_pid6592.log:
---
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d72dff0, pid=6592, tid=412
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_05-b05 mixed mode)
# Problematic frame:
# V  [jvm.dll+0xedff0]
#

---------------  T H R E A D  ---------------

Current thread (0x00a32800):  VMThread [id=412]

siginfo: ExceptionCode=0xc0000005, reading address 0x00000000

Registers:
EAX=0x00000000, EBX=0x00000001, ECX=0x0aabfbf0, EDX=0x00000000
ESP=0x0aabf7c0, EBP=0x0aabf7c4, ESI=0x0aabfbf0, EDI=0x075596a8
EIP=0x6d72dff0, EFLAGS=0x00010246

Top of Stack: (sp=0x0aabf7c0)
0x0aabf7c0:   0aabfbf0 0aabfc1c 6d72e415 00000028
0x0aabf7d0:   0aabfbf0 6d6b0dde 0aabfd48 6d6b0cc2
0x0aabf7e0:   0aabfc0c 0aabfd48 0aabfc58 4fffffff
0x0aabf7f0:   2fffffff 2fffffff 2fffffff 2fffffff
0x0aabf800:   2fffffff 2fffffff 00000115 0aabfa3c
0x0aabf810:   7c911538 7c911596 7c9106eb 00355fe8
0x0aabf820:   00000003 00000001 00000001 0aabfd48
0x0aabf830:   00000001 0aabfc78 0aabfc78 6d72e22b 

Instructions: (pc=0x6d72dff0)
0x6d72dfe0:   5e c2 08 00 55 8b ec 56 8b f1 8b 46 04 8b 56 08
0x6d72dff0:   8b 08 8a 45 08 38 44 11 0a 74 19 0f be c0 50 68 


Stack: [0x0aa80000,0x0aac0000),  sp=0x0aabf7c0,  free space=253k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [jvm.dll+0xedff0]
V  [jvm.dll+0xee415]
V  [jvm.dll+0x7040d]
V  [jvm.dll+0x6fe8f]

VM_Operation (0x0ab7fb24): get/set locals, mode: safepoint, requested by thread 0x00a463a0


---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x00356d18 JavaThread "DestroyJavaVM" [_thread_blocked, id=8204]
  0x0ae7b650 JavaThread "TimerQueue" daemon [_thread_blocked, id=8580]
  0x0adddcd0 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=7788]
  0x0ad9dda8 JavaThread "AWT-Shutdown" [_thread_blocked, id=8092]
  0x0adaf030 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=9236]
  0x0ad9e5d8 JavaThread "AWT-Windows" daemon [_thread_in_native, id=8156]
  0x00a4d9b0 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=9328]
  0x00a4bf50 JavaThread "CompilerThread0" daemon [_thread_blocked, id=6796]
  0x00a4bc30 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=8248]
  0x00a48a68 JavaThread "JDWP Command Reader" daemon [_thread_in_native, id=10128]
  0x00a47bc0 JavaThread "JDWP Event Helper Thread" daemon [_thread_blocked, id=9360]
  0x00a463a0 JavaThread "JDWP Transport Listener: dt_socket" daemon [_thread_blocked, id=8228]
  0x00a37dd8 JavaThread "Finalizer" daemon [_thread_blocked, id=9468]
  0x00a36948 JavaThread "Reference Handler" daemon [_thread_blocked, id=8440]

Other Threads:
=>0x00a32800 VMThread [id=412]
  0x00a4ebf8 WatcherThread [id=9176]

VM state:at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread:  ([mutex/lock_event])
[0x00356368/0x00002720] Threads_lock - owner thread: 0x00a32800

Heap
 def new generation   total 576K, used 248K [0x02a80000, 0x02b20000, 0x02f60000)
  eden space 512K,  36% used [0x02a80000, 0x02aae200, 0x02b00000)
  from space 64K, 100% used [0x02b00000, 0x02b10000, 0x02b10000)
  to   space 64K,   0% used [0x02b10000, 0x02b10000, 0x02b20000)
 tenured generation   total 3704K, used 2230K [0x02f60000, 0x032fe000, 0x06a80000)
   the space 3704K,  60% used [0x02f60000, 0x0318d820, 0x0318da00, 0x032fe000)
 compacting perm gen  total 11520K, used 11368K [0x06a80000, 0x075c0000, 0x0aa80000)
   the space 11520K,  98% used [0x06a80000, 0x0759a0f0, 0x0759a200, 0x075c0000)
No shared spaces configured.

Dynamic libraries:
0x00400000 - 0x0040c000 	C:\Program Files\Java\jre1.5.0_05\bin\javaw.exe
0x7c900000 - 0x7c9b0000 	C:\WINDOWS\system32\ntdll.dll
0x7c800000 - 0x7c8f4000 	C:\WINDOWS\system32\kernel32.dll
0x77dd0000 - 0x77e6b000 	C:\WINDOWS\system32\ADVAPI32.dll
0x77e70000 - 0x77f01000 	C:\WINDOWS\system32\RPCRT4.dll
0x77d40000 - 0x77dd0000 	C:\WINDOWS\system32\USER32.dll
0x77f10000 - 0x77f56000 	C:\WINDOWS\system32\GDI32.dll
0x77c10000 - 0x77c68000 	C:\WINDOWS\system32\MSVCRT.dll
0x6d640000 - 0x6d7cc000 	C:\Program Files\Java\jre1.5.0_05\bin\client\jvm.dll
0x76b40000 - 0x76b6d000 	C:\WINDOWS\system32\WINMM.dll
0x6d280000 - 0x6d288000 	C:\Program Files\Java\jre1.5.0_05\bin\hpi.dll
0x76bf0000 - 0x76bfb000 	C:\WINDOWS\system32\PSAPI.DLL
0x6d380000 - 0x6d3b5000 	C:\Program Files\Java\jre1.5.0_05\bin\jdwp.dll
0x6d610000 - 0x6d61c000 	C:\Program Files\Java\jre1.5.0_05\bin\verify.dll
0x6d300000 - 0x6d31d000 	C:\Program Files\Java\jre1.5.0_05\bin\java.dll
0x6d630000 - 0x6d63f000 	C:\Program Files\Java\jre1.5.0_05\bin\zip.dll
0x6d220000 - 0x6d227000 	C:\Program Files\Java\jre1.5.0_05\bin\dt_socket.dll
0x71ab0000 - 0x71ac7000 	C:\WINDOWS\system32\WS2_32.dll
0x71aa0000 - 0x71aa8000 	C:\WINDOWS\system32\WS2HELP.dll
0x71a50000 - 0x71a8f000 	C:\WINDOWS\System32\mswsock.dll
0x76f20000 - 0x76f47000 	C:\WINDOWS\system32\DNSAPI.dll
0x76fb0000 - 0x76fb8000 	C:\WINDOWS\System32\winrnr.dll
0x76f60000 - 0x76f8c000 	C:\WINDOWS\system32\WLDAP32.dll
0x76fc0000 - 0x76fc6000 	C:\WINDOWS\system32\rasadhlp.dll
0x662b0000 - 0x66308000 	C:\WINDOWS\system32\hnetcfg.dll
0x71a90000 - 0x71a98000 	C:\WINDOWS\System32\wshtcpip.dll
0x6d000000 - 0x6d167000 	C:\Program Files\Java\jre1.5.0_05\bin\awt.dll
0x73000000 - 0x73026000 	C:\WINDOWS\system32\WINSPOOL.DRV
0x76390000 - 0x763ad000 	C:\WINDOWS\system32\IMM32.dll
0x774e0000 - 0x7761d000 	C:\WINDOWS\system32\ole32.dll
0x5ad70000 - 0x5ada8000 	C:\WINDOWS\system32\uxtheme.dll
0x73760000 - 0x737a9000 	C:\WINDOWS\system32\ddraw.dll
0x73bc0000 - 0x73bc6000 	C:\WINDOWS\system32\DCIMAN32.dll
0x73940000 - 0x73a10000 	C:\WINDOWS\system32\D3DIM700.DLL
0x74720000 - 0x7476c000 	C:\WINDOWS\system32\MSCTF.dll
0x7c9c0000 - 0x7d1d4000 	C:\WINDOWS\system32\shell32.dll
0x77f60000 - 0x77fd6000 	C:\WINDOWS\system32\SHLWAPI.dll
0x773d0000 - 0x774d3000 	C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2527_x-ww_aa415c8a\comctl32.dll
0x5d090000 - 0x5d12a000 	C:\WINDOWS\system32\comctl32.dll
0x6d240000 - 0x6d27d000 	C:\Program Files\Java\jre1.5.0_05\bin\fontmanager.dll
0x6d4c0000 - 0x6d4d3000 	C:\Program Files\Java\jre1.5.0_05\bin\net.dll
0x6d4e0000 - 0x6d4e9000 	C:\Program Files\Java\jre1.5.0_05\bin\nio.dll
0x50140000 - 0x50157000 	C:\Program Files\Common Files\ReGet Shared\CatchOp.dll
0x77120000 - 0x771ac000 	C:\WINDOWS\system32\OLEAUT32.dll
0x10000000 - 0x10006000 	C:\Program Files\Punto Switcher\correct.dll
0x20000000 - 0x20013000 	C:\Program Files\ABBYY Lingvo 10 Multilingual Dictionary\LvHook.dll
0x6d1c0000 - 0x6d1e3000 	C:\Program Files\Java\jre1.5.0_05\bin\dcpr.dll

VM Arguments:
jvm_args: -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,suspend=y,address=localhost:1059
java_command: project.StartApplication

Environment Variables:
JAVA_HOME=C:\Program Files\Java\jdk1.5.0_05\
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Rational\common;C:\Program Files\Subversion\bin;C:\Program Files\Perforce;C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual Studio\Common\Tools;C:\Program Files\Microsoft Visual Studio\VC98\bin
USERNAME=Ortega
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 6 Model 8 Stepping 1, AuthenticAMD



---------------  S Y S T E M  ---------------

OS: Windows XP Build 2600 Service Pack 2

CPU:total 1 family 6, cmov, cx8, fxsr, mmx, sse

Memory: 4k page, physical 507376k(83616k free), swap 989144k(546092k free)

vm_info: Java HotSpot(TM) Client VM (1.5.0_05-b05) for windows-x86, built on Aug 26 2005 15:36:02 by "java_re" with MS VC++ 6.0
----
Comment 1 Kevin Barnes CLA 2005-12-03 20:23:10 EST
Looks more like a VM bug then a bug in the debugger. Does the VM crash always occur at the same place? What line are you stepping into/over when it crashes? Are you running Eclipse itself with 5.0 or just the target. 
I was able to successfully step through all of the code on my mac.
Comment 2 Darin Wright CLA 2005-12-05 12:07:37 EST
This is a VM crash. You shuold file a bug with Sun.
Comment 3 GSMD CLA 2005-12-06 10:50:42 EST
Created attachment 31206 [details]
code sample which runs into error
Comment 4 GSMD CLA 2005-12-06 10:58:23 EST
Comment on attachment 31206 [details]
code sample which runs into error

The sample code runs into error with breakpoint on line #15,
the same code runs smoothly under JBuilder and Idea.
Do you consider it to be JVM error?
Comment 5 Darin Wright CLA 2005-12-06 11:05:45 EST
Yes, it shows a crash in a VM dll. This is a VM bug.
Comment 6 Kevin Barnes CLA 2005-12-06 11:36:39 EST
This may be a compiler bug. If I compile the sample coed with an Ant builder that uses javac, I can debug it normally, but if I use Eclipse's compiler, the VM exits when the breakpoint is hit.
I tested it with Apple's 1.5 VM
Comment 7 Kevin Barnes CLA 2005-12-06 11:37:17 EST
moving to jcore for comment.
Comment 8 Olivier Thomann CLA 2005-12-06 11:42:57 EST
You should try to disable the JIT.
Comment 9 Olivier Thomann CLA 2005-12-15 09:36:07 EST
I think I found the problem.
One of the line number attribute is boggus.
If the continue; statement is removed, everything works fine again.
The generation of the continue optimizes a jump to the next bytecode, but the line number table is not updated and there is an invalid pc in the table.
  // Method descriptor #6 ()V
  // Stack: 2, Locals: 3
  public void buggyMethod();
     0  new java.util.HashSet [17]
     3  dup
     4  invokespecial java.util.HashSet() [19]
     7  invokevirtual java.util.HashSet.iterator() : java.util.Iterator [20]
    10  astore_2
    11  goto 28
    14  aload_2
    15  invokeinterface java.util.Iterator.next() : java.lang.Object [24] [nargs: 1]
    20  astore_1
    21  getstatic java.lang.System.out : java.io.PrintStream [30]
    24  aload_1
    25  invokevirtual java.io.PrintStream.println(java.lang.Object) : void [36]
    28  aload_2
    29  invokeinterface java.util.Iterator.hasNext() : boolean [42] [nargs: 1]
    34  ifne 14
    37  return
      Line numbers:
        [pc: 0, line: 12]
        [pc: 21, line: 14]
        [pc: 31, line: 12]
        [pc: 37, line: 17]

pc 31 is not a valid target.

Without the continue statement, we get:

  // Method descriptor #6 ()V
  // Stack: 2, Locals: 3
  public void buggyMethod();
     0  new java.util.HashSet [17]
     3  dup
     4  invokespecial java.util.HashSet() [19]
     7  invokevirtual java.util.HashSet.iterator() : java.util.Iterator [20]
    10  astore_2
    11  goto 28
    14  aload_2
    15  invokeinterface java.util.Iterator.next() : java.lang.Object [24] [nargs: 1]
    20  astore_1
    21  getstatic java.lang.System.out : java.io.PrintStream [30]
    24  aload_1
    25  invokevirtual java.io.PrintStream.println(java.lang.Object) : void [36]
    28  aload_2
    29  invokeinterface java.util.Iterator.hasNext() : boolean [42] [nargs: 1]
    34  ifne 14
    37  return
      Line numbers:
        [pc: 0, line: 12]
        [pc: 21, line: 14]
        [pc: 28, line: 12]
        [pc: 37, line: 17]
and all pcs in the line number table are valid targets.

I am investigating.
Comment 10 Olivier Thomann CLA 2005-12-15 10:19:15 EST
Created attachment 31816 [details]
Proposed fix
Comment 11 Jim Holmlund CLA 2005-12-15 13:09:43 EST
See also:
   http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6361363
Comment 12 Olivier Thomann CLA 2005-12-15 13:45:41 EST
The right workaround is to remove the continue statement that is useless anyway.
Comment 13 Olivier Thomann CLA 2005-12-15 14:42:05 EST
I checked all the Eclipse jars and none of them contains such a boggus line number table entry.
Comment 14 Olivier Thomann CLA 2005-12-16 22:40:15 EST
Fixed and released in HEAD.
Regression test added in org.eclipse.jdt.core.tests.compiler.regression.ForeachStatementTest.test038.
Comment 15 Maxime Daniel CLA 2006-02-15 09:21:55 EST
Verified for 3.2 M5 using build I20060215-0010.