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

internal compiler error during instruction selection

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.0.7
    • Fix Version/s: None
    • Component/s: Static compilation
    • Labels:
      None

      Description

      I have the following (incorrect) program

       

      class Foo {
        static void foo() {
          return 1   
        }
      }
      

      The compiler crashes during the instruction selection phase producing the following output. From what I understand is that the type checker misses the error, and the compiler crashes during bytecode generation.

        

      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      General error during instruction selection: Cannot use return statement with an expression on a method that returns void
      . At [3:5] Main.groovyorg.codehaus.groovy.syntax.RuntimeParserException: Cannot use return statement with an expression on a method that returns void
      . At [3:5] Main.groovy
              at org.codehaus.groovy.classgen.AsmClassGenerator.throwException(AsmClassGenerator.java:2185)
              at org.codehaus.groovy.classgen.asm.StatementWriter.writeReturn(StatementWriter.java:605)
              at org.codehaus.groovy.classgen.AsmClassGenerator.visitReturnStatement(AsmClassGenerator.java:681)
              at org.codehaus.groovy.ast.stmt.ReturnStatement.visit(ReturnStatement.java:73)
              at org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:94)
              at org.codehaus.groovy.classgen.asm.sc.StaticTypesStatementWriter.writeBlockStatement(StaticTypesStatementWriter.java:78)
              at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:617)
              at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69)
              at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:138)
              at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:111)
              at org.codehaus.groovy.classgen.AsmClassGenerator.visitStdMethod(AsmClassGenerator.java:461)
              at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:408)
              at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:106)
              at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:556)
              at org.codehaus.groovy.ast.ClassNode.visitMethods(ClassNode.java:1099)
              at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1092)
              at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:52)
              at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:271)
              at org.codehaus.groovy.control.CompilationUnit$3.call(CompilationUnit.java:797)
              at org.codehaus.groovy.control.CompilationUnit$IPrimaryClassNodeOperation.doPhaseOperation(CompilationUnit.java:942)
              at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:671)
              at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:635)
              at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:610)
              at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:311)
              at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:240)
              at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompile(FileSystemCompiler.java:165)
              at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompileWithErrorHandling(FileSystemCompiler.java:205)
              at org.codehaus.groovy.tools.FileSystemCompiler.main(FileSystemCompiler.java:189)
              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.base/java.lang.reflect.Method.invoke(Method.java:566)
              at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:111)
              at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:129)1 error
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              theosot Thodoris Sotiropoulos

              Dates

              • Created:
                Updated:

                Issue deployment