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

Compiler error in STC: exception in phase 'instruction selection'

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.5.2
    • Fix Version/s: 3.0.0-alpha-4, 2.5.3
    • Component/s: Static compilation
    • Labels:
      None
    • Environment:
      Java 8u181, Ubuntu 18.04

      Description

      Following source compiles under 2.5.1 and 3.0alpha3, but not 2.5.2:

      @groovy.transform.CompileStatic
      class A {
      
         private List<String> fooNames = []
      
         public A(Collection<String> names) {
            names.each { fooNames << it }
         }
      
         public List<String> getFooNames() { fooNames }
      
      }
      

      error message is:

      >>> a serious error occurred: BUG! exception in phase 'instruction selection' in source unit 'A.groovy' Tried to overwrite existing meta data org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] property: ConstantExpression[fooNames]].
      >>> stacktrace:
      BUG! exception in phase 'instruction selection' in source unit 'A.groovy' Tried to overwrite existing meta data org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] property: ConstantExpression[fooNames]].
          at org.codehaus.groovy.ast.ASTNode.setNodeMetaData(ASTNode.java:154)
          at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.checkOrMarkPrivateAccess(StaticTypeCheckingVisitor.java:501)
          at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.storeField(StaticTypeCheckingVisitor.java:1711)
          at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1473)
          at org.codehaus.groovy.transform.sc.StaticCompilationVisitor.existsProperty(StaticCompilationVisitor.java:522)
          at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1381)
          at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitPropertyExpressionSilent(StaticTypeCheckingVisitor.java:726)
          at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.tryVariableExpressionAsProperty(StaticTypeCheckingVisitor.java:711)
          at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitVariableExpression(StaticTypeCheckingVisitor.java:630)
          at org.codehaus.groovy.ast.expr.VariableExpression.visit(VariableExpression.java:72)
          at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBinaryExpression(StaticTypeCheckingVisitor.java:785)
          at org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:51)
          at org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)
          at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:197)
          at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
          at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:88)
          at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:106)
          at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBlockStatement(StaticTypeCheckingVisitor.java:3628)
          at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
          at org.codehaus.groovy.ast.CodeVisitorSupport.visitClosureExpression(CodeVisitorSupport.java:227)
          at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClosureExpression(StaticTypeCheckingVisitor.java:2286)
          at org.codehaus.groovy.ast.expr.ClosureExpression.visit(ClosureExpression.java:49)
          at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallArguments(StaticTypeCheckingVisitor.java:2596)
          at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:3286)
          at org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethodCallExpression(StaticCompilationVisitor.java:397)
          at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:70)
          at org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)
          at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:197)
          at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
          at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:88)
          at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:106)
          at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBlockStatement(StaticTypeCheckingVisitor.java:3628)
          at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
          at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:110)
          at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:121)
          at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitConstructorOrMethod(StaticTypeCheckingVisitor.java:2043)
          at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructor(ClassCodeVisitorSupport.java:128)
          at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitConstructor(StaticTypeCheckingVisitor.java:2393)
          at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1099)
          at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:54)
          at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClass(StaticTypeCheckingVisitor.java:387)
          at org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitClass(StaticCompilationVisitor.java:182)
          at org.codehaus.groovy.transform.sc.StaticCompileTransformation.visit(StaticCompileTransformation.java:67)
          at org.codehaus.groovy.transform.ASTTransformationVisitor.visitClass(ASTTransformationVisitor.java:153)
          at org.codehaus.groovy.transform.ASTTransformationVisitor$2.call(ASTTransformationVisitor.java:197)
          at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1087)
          at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:631)
          at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:609)
          at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:586)
          at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:565)
          at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:75)
          at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:243)
          at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompile(FileSystemCompiler.java:166)
          at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompileWithErrorHandling(FileSystemCompiler.java:206)
          at org.codehaus.groovy.tools.FileSystemCompiler.main(FileSystemCompiler.java:190)
          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:498)
          at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:114)
          at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:136)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                paulk Paul King
                Reporter:
                patric42 Patric Bechtel
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: