Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-7110

Error while popping argument from operand stack tracker

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.4, 2.3.7
    • 2.3.8, 2.4.0-beta-4
    • Static compilation
    • Oracle JVM 1.8.0_11
      Linux 64 bit

    Description

      I have the following piece of Groovy code:

      Test.groovy
      import groovy.transform.CompileStatic
      
      @CompileStatic
      class Test
      {	
      	List<Inner> inners = [new Inner(), new Inner(), new Inner()]
      	
      	Map test()
      	{
      		Map systems = ["test1":0, "test2":0, "test3":0, "test4":0]
      
      		for(i in inners)
      		{
      			systems["test1"] += i.l1.size()
      			systems["test2"] += i.l2.size()
      			systems["test3"] += i.l3.size()
      			systems["test4"] += i.l4.size()
      		}
      
      		return systems
      	}
      
      	class Inner
      	{
      		List l1 = [1, 2, 3]
      		List l2 = [1]
      		List l3 = [1, 2]
      		List l4 = [1, 2, 3, 4]
      	}
      }
      

      Trying to compile it produces this error:

      mfb@home:/opt/groovy/bin$ ./groovyc ~/tmp/Test.groovy 
      >>> a serious error occurred: BUG! exception in phase 'class generation' in source unit '/home/mfb/tmp/Test.groovy' Error while popping argument from operand stack tracker in class Test method java.util.Map test().
      >>> stacktrace:
      BUG! exception in phase 'class generation' in source unit '/home/mfb/tmp/Test.groovy' Error while popping argument from operand stack tracker in class Test method java.util.Map test().
      	at org.codehaus.groovy.classgen.asm.OperandStack.popWithMessage(OperandStack.java:68)
      	at org.codehaus.groovy.classgen.asm.OperandStack.popDownTo(OperandStack.java:52)
      	at org.codehaus.groovy.classgen.asm.OperandStack.pop(OperandStack.java:155)
      	at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.evaluateArrayAssignmentWithOperator(BinaryExpressionHelper.java:551)
      	at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.evaluateBinaryExpressionWithAssignment(BinaryExpressionHelper.java:567)
      	at org.codehaus.groovy.classgen.asm.BinaryExpressionMultiTypeDispatcher.evaluateBinaryExpressionWithAssignment(BinaryExpressionMultiTypeDispatcher.java:358)
      	at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.eval(BinaryExpressionHelper.java:149)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitBinaryExpression(AsmClassGenerator.java:628)
      	at org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:49)
      	at org.codehaus.groovy.classgen.asm.StatementWriter.writeExpressionStatement(StatementWriter.java:604)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitExpressionStatement(AsmClassGenerator.java:610)
      	at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40)
      	at org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:81)
      	at org.codehaus.groovy.classgen.asm.sc.StaticTypesStatementWriter.writeBlockStatement(StaticTypesStatementWriter.java:49)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:556)
      	at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69)
      	at org.codehaus.groovy.classgen.asm.sc.StaticTypesStatementWriter.writeForInLoop(StaticTypesStatementWriter.java:102)
      	at org.codehaus.groovy.classgen.asm.StatementWriter.writeForStatement(StatementWriter.java:93)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitForLoop(AsmClassGenerator.java:560)
      	at org.codehaus.groovy.ast.stmt.ForStatement.visit(ForStatement.java:47)
      	at org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:81)
      	at org.codehaus.groovy.classgen.asm.sc.StaticTypesStatementWriter.writeBlockStatement(StaticTypesStatementWriter.java:49)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:556)
      	at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69)
      	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:101)
      	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:112)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitStdMethod(AsmClassGenerator.java:420)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:377)
      	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:123)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:497)
      	at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1063)
      	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:50)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:231)
      	at org.codehaus.groovy.control.CompilationUnit$16.call(CompilationUnit.java:805)
      	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1047)
      	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:583)
      	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:561)
      	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:538)
      	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:517)
      	at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:59)
      	at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:215)
      	at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompile(FileSystemCompiler.java:148)
      	at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompileWithErrorHandling(FileSystemCompiler.java:178)
      	at org.codehaus.groovy.tools.FileSystemCompiler.main(FileSystemCompiler.java:162)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:483)
      	at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:106)
      	at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:128)
      

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            haimat Matthias Brandstetter
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: