Bug 238923 - [1.6][compiler] Internal compiler error caused by a for loop in an initializer block
Summary: [1.6][compiler] Internal compiler error caused by a for loop in an initialize...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: 3.4.1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 241044 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-06-29 21:33 EDT by Tushar Pokle CLA
Modified: 2009-03-13 16:39 EDT (History)
7 users (show)

See Also:
philippe_mulet: pmc_approved+


Attachments
Patch + regression tests for HEAD (4.15 KB, patch)
2008-07-07 21:54 EDT, Olivier Thomann CLA
no flags Details | Diff
Simplified patch + regression test for HEAD (3.53 KB, patch)
2008-07-07 22:00 EDT, Olivier Thomann CLA
no flags Details | Diff
Same fix for 3.4 maintenance stream (3.57 KB, patch)
2008-07-07 22:00 EDT, 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 Tushar Pokle CLA 2008-06-29 21:33:05 EDT
Build ID:  I20080617-2000

Steps To Reproduce:
1. Compile the following class in Eclipse 3.4:

public class Error {

    {
        for (boolean b : new boolean[] {}) {
        }
    }

    public Error() {
    }

    public Error(boolean gg) {
    }

}

2. You should get the following internal compiler error:

java.lang.IllegalArgumentException: info cannot be null
	at org.eclipse.jdt.internal.compiler.codegen.StackMapFrame.addStackItem(StackMapFrame.java:81)
	at org.eclipse.jdt.internal.compiler.ClassFile.traverse(ClassFile.java:7498)
	at org.eclipse.jdt.internal.compiler.ClassFile.completeCodeAttribute(ClassFile.java:1613)
	at org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration.internalGenerateCode(ConstructorDeclaration.java:336)
	at org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration.generateCode(ConstructorDeclaration.java:192)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:530)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:581)
	at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.generateCode(CompilationUnitDeclaration.java:356)
	at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:755)
	at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:137)
	at java.lang.Thread.run(Unknown Source)



More information:
It compiles successfully with Sun's Javac 1.6 as well as Eclipse 3.2, but not with Ganymede Eclipse 3.4.
Comment 1 Olivier Thomann CLA 2008-07-07 21:54:21 EDT
Created attachment 106772 [details]
Patch + regression tests for HEAD
Comment 2 Olivier Thomann CLA 2008-07-07 22:00:23 EDT
Created attachment 106773 [details]
Simplified patch + regression test for HEAD
Comment 3 Olivier Thomann CLA 2008-07-07 22:00:47 EDT
Created attachment 106774 [details]
Same fix for 3.4 maintenance stream
Comment 4 Philipe Mulet CLA 2008-07-08 04:57:09 EDT
+1 for 3.4.1
Comment 5 Olivier Thomann CLA 2008-07-08 09:22:49 EDT
Released for 3.4.1.
Comment 6 Tushar Pokle CLA 2008-07-08 10:28:47 EDT
Thanks very much Olivier and Philippe :)
Comment 7 Olivier Thomann CLA 2008-07-08 10:42:28 EDT
(In reply to comment #6)
> Thanks very much Olivier and Philippe :)
You are welcome. Good test cases deserve quick fixes :-). I was on vacations till yesterday otherwise it would have been fixed earlier.
Comment 8 Philipe Mulet CLA 2008-07-16 09:28:01 EDT
*** Bug 241044 has been marked as a duplicate of this bug. ***
Comment 9 Kent Johnson CLA 2008-08-06 12:39:06 EDT
Verified for 3.5M1 using I20080805-1307
Comment 10 Jerome Lanneluc CLA 2008-08-29 04:26:53 EDT
To reproduce you need to have a 1.6 compiler compliance level.

Verified for 3.4.1 using M20080827-2000
Comment 11 Irwin CLA 2009-03-13 15:44:45 EDT
I just reproduced this bug (not using the test code) with 

Version: 3.4.1
Build id: M20080911-1700
	
Internal compiler error
java.lang.IllegalArgumentException: info cannot be null
	at org.eclipse.jdt.internal.compiler.codegen.StackMapFrame.addStackItem(StackMapFrame.java:81)
	at org.eclipse.jdt.internal.compiler.ClassFile.traverse(ClassFile.java:7497)
	at org.eclipse.jdt.internal.compiler.ClassFile.completeCodeAttribute(ClassFile.java:1613)
	at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.generateCode(AbstractMethodDeclaration.java:244)
	at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.generateCode(AbstractMethodDeclaration.java:179)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:530)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:564)
	at org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression.generateCode(QualifiedAllocationExpression.java:169)
	at org.eclipse.jdt.internal.compiler.ast.FieldDeclaration.generateCode(FieldDeclaration.java:104)
	at org.eclipse.jdt.internal.compiler.ast.Clinit.generateCode(Clinit.java:253)
	at org.eclipse.jdt.internal.compiler.ast.Clinit.generateCode(Clinit.java:103)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:530)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:581)
	at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.generateCode(CompilationUnitDeclaration.java:356)
	at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:755)
	at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:137)
	at java.lang.Thread.run(Unknown Source)

Can you confirm this was supposed to be fixed in that version ? 

Comment 12 Olivier Thomann CLA 2009-03-13 15:50:47 EDT
Can you provide a test case to make sure this is the same problem?
The stack trace is not identical.
Comment 13 Olivier Thomann CLA 2009-03-13 15:52:56 EDT
It could also be bug 251539 which we could not reproduce so far.
So a test case would be awesome for a fix in 3.5.
Please update bug 251539 with a test case.
Many thanks.
Comment 14 Irwin CLA 2009-03-13 16:39:29 EDT
indeed. following up on bug 251539