Details

      Description

      @JamesIry: I assigned the bug to you, but feel free to bounce it back if you don't have time. Thanks

      Btw, it's a regression from 2.9 (or a bug specific to the asm backend?)

      Here goes, compiled via sbt to try different versions of the compiler:

      $ cat src/main/scala/Test.scala 
      object Test extends App {
      
        @inline final def mbarray_apply_minibox(array: Any, tag: Byte): Long =
          if (tag == 0) {
            array.asInstanceOf[Array[Long]](0)
          } else
            array.asInstanceOf[Array[Byte]](0).toLong
      
        def crash_method(): Unit =
          mbarray_apply_minibox(null, 0)
      }
      
      $ cat build.sbt 
      
      scalacOptions in Compile += "-optimize"
      
      resolvers in ThisBuild += ScalaToolsSnapshots
      
      $ sbt -sbt-version 0.12.1
      Detected sbt version 0.12.1
      Starting sbt: invoke with -help for other options
      Picked up _JAVA_OPTIONS: -Xms2g -Xmx2g -Xss4m -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=512M -XX:ReservedCodeCacheSize=256m -XX:+UseParallelGC -XX:PermSize=256m -XX:+TieredCompilation -XX:+UseNUMA
      [info] Set current project to default-5d6c1b (in build file:/mnt/data-local/Work/Workspace/dev/backend-bug/)
      > 
      > 
      > 
      > clean
      [success] Total time: 0 s, completed Feb 3, 2013 10:24:15 PM
      > ++ 2.9.3-SNAPSHOT compile
      Setting version to 2.9.3-SNAPSHOT
      [info] Set current project to default-5d6c1b (in build file:/mnt/data-local/Work/Workspace/dev/backend-bug/)
      [info] Updating {file:/mnt/data-local/Work/Workspace/dev/backend-bug/}default-5d6c1b...
      [info] Resolving org.scala-lang#scala-library;2.9.3-SNAPSHOT ...
      [info] Done updating.
      [info] Compiling 1 Scala source to /mnt/data-local/Work/Workspace/dev/backend-bug/target/scala-2.9.3-SNAPSHOT/classes...
      [success] Total time: 5 s, completed Feb 3, 2013 10:24:22 PM
      > 
      > 
      > 
      > 
      > clean
      [success] Total time: 0 s, completed Feb 3, 2013 10:24:27 PM
      > ++ 2.10.1-SNAPSHOT compile
      Setting version to 2.10.1-SNAPSHOT
      [info] Set current project to default-5d6c1b (in build file:/mnt/data-local/Work/Workspace/dev/backend-bug/)
      [info] Updating {file:/mnt/data-local/Work/Workspace/dev/backend-bug/}default-5d6c1b...
      [info] Resolving org.scala-lang#scala-library;2.10.1-SNAPSHOT ...
      [info] Done updating.
      [info] Compiling 1 Scala source to /mnt/data-local/Work/Workspace/dev/backend-bug/target/scala-2.10/classes...
      [error] 
      [error]      while compiling: /mnt/data-local/Work/Workspace/dev/backend-bug/src/main/scala/Test.scala
      [error]         during phase: jvm
      [error]      library version: version 2.10.1-20130131-134838-d672102fd8
      [error]     compiler version: version 2.10.1-20130131-134838-d672102fd8
      [error]   reconstructed args: -classpath /mnt/data-local/Work/Workspace/dev/backend-bug/target/scala-2.10/classes -Ydead-code -optimise -d /mnt/data-local/Work/Workspace/dev/backend-bug/target/scala-2.10/classes -Yinline -Yclosure-elim -Yinline-handlers -bootclasspath /usr/lib/jvm/java-7-oracle/jre/lib/resources.jar:/usr/lib/jvm/java-7-oracle/jre/lib/rt.jar:/usr/lib/jvm/java-7-oracle/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jsse.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jce.jar:/usr/lib/jvm/java-7-oracle/jre/lib/charsets.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jfr.jar:/usr/lib/jvm/java-7-oracle/jre/classes:/home/sun/.sbt/boot/scala-2.10.1-SNAPSHOT/lib/scala-library.jar
      [error] 
      [error]   last tree to typer: TypeTree(trait App)
      [error]               symbol: trait App in package scala (flags: <interface> abstract <trait> <lateinterface>)
      [error]    symbol definition: abstract trait App extends DelayedInit
      [error]                  tpe: App
      [error]        symbol owners: trait App -> package scala
      [error]       context owners: object Test -> package <empty>
      [error] 
      [error] == Enclosing template or block ==
      [error] 
      
      looong useless output
      
      [error] 
      [error] == Expanded type of tree ==
      [error] 
      [error] TypeRef(TypeSymbol(abstract trait App extends DelayedInit))
      [error] 
      [error] uncaught exception during compilation: java.lang.ArrayIndexOutOfBoundsException
      [trace] Stack trace suppressed: run last compile:compile for the full output.
      [error] (compile:compile) java.lang.ArrayIndexOutOfBoundsException: 0
      [error] Total time: 4 s, completed Feb 3, 2013 10:24:35 PM
      > last compile:compile
      [debug] 
      [debug] Initial source changes: 
      [debug] 	removed:Set()
      [debug] 	added: Set(/mnt/data-local/Work/Workspace/dev/backend-bug/src/main/scala/Test.scala)
      [debug] 	modified: Set()
      [debug] Removed products: Set()
      [debug] Modified external sources: Set()
      [debug] Modified binary dependencies: Set()
      [debug] Initial directly invalidated sources: Set(/mnt/data-local/Work/Workspace/dev/backend-bug/src/main/scala/Test.scala)
      [debug] 
      [debug] Sources indirectly invalidated by:
      [debug] 	product: Set()
      [debug] 	binary dep: Set()
      [debug] 	external source: Set()
      [debug] Initially invalidated: Set(/mnt/data-local/Work/Workspace/dev/backend-bug/src/main/scala/Test.scala)
      [info] Compiling 1 Scala source to /mnt/data-local/Work/Workspace/dev/backend-bug/target/scala-2.10/classes...
      [debug] Running cached compiler 27e675fc, interfacing (CompilerInterface) with Scala compiler version 2.10.1-20130131-134838-d672102fd8
      [debug] Calling Scala compiler with arguments  (CompilerInterface):
      [debug] 	-optimize
      [debug] 	-d
      [debug] 	/mnt/data-local/Work/Workspace/dev/backend-bug/target/scala-2.10/classes
      [debug] 	-bootclasspath
      [debug] 	/usr/lib/jvm/java-7-oracle/jre/lib/resources.jar:/usr/lib/jvm/java-7-oracle/jre/lib/rt.jar:/usr/lib/jvm/java-7-oracle/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jsse.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jce.jar:/usr/lib/jvm/java-7-oracle/jre/lib/charsets.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jfr.jar:/usr/lib/jvm/java-7-oracle/jre/classes:/home/sun/.sbt/boot/scala-2.10.1-SNAPSHOT/lib/scala-library.jar
      [debug] 	-classpath
      [debug] 	/mnt/data-local/Work/Workspace/dev/backend-bug/target/scala-2.10/classes
      [error] 
      [error]      while compiling: /mnt/data-local/Work/Workspace/dev/backend-bug/src/main/scala/Test.scala
      [error]         during phase: jvm
      [error]      library version: version 2.10.1-20130131-134838-d672102fd8
      [error]     compiler version: version 2.10.1-20130131-134838-d672102fd8
      [error]   reconstructed args: -classpath /mnt/data-local/Work/Workspace/dev/backend-bug/target/scala-2.10/classes -Ydead-code -optimise -d /mnt/data-local/Work/Workspace/dev/backend-bug/target/scala-2.10/classes -Yinline -Yclosure-elim -Yinline-handlers -bootclasspath /usr/lib/jvm/java-7-oracle/jre/lib/resources.jar:/usr/lib/jvm/java-7-oracle/jre/lib/rt.jar:/usr/lib/jvm/java-7-oracle/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jsse.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jce.jar:/usr/lib/jvm/java-7-oracle/jre/lib/charsets.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jfr.jar:/usr/lib/jvm/java-7-oracle/jre/classes:/home/sun/.sbt/boot/scala-2.10.1-SNAPSHOT/lib/scala-library.jar
      [error] 
      [error]   last tree to typer: TypeTree(trait App)
      [error]               symbol: trait App in package scala (flags: <interface> abstract <trait> <lateinterface>)
      [error]    symbol definition: abstract trait App extends DelayedInit
      [error]                  tpe: App
      [error]        symbol owners: trait App -> package scala
      [error]       context owners: object Test -> package <empty>
      [error] 
      [error] == Enclosing template or block ==
      [error] 
      
      looong useless output
      
      [error] 
      [error] == Expanded type of tree ==
      [error] 
      [error] TypeRef(TypeSymbol(abstract trait App extends DelayedInit))
      [error] 
      [error] uncaught exception during compilation: java.lang.ArrayIndexOutOfBoundsException
      java.lang.ArrayIndexOutOfBoundsException: 0
      	at scala.tools.asm.Frame.merge(Unknown Source)
      	at scala.tools.asm.Frame.merge(Unknown Source)
      	at scala.tools.asm.MethodWriter.visitMaxs(Unknown Source)
      	at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genMethod(GenASM.scala:1565)
      	at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genClass(GenASM.scala:1398)
      	at scala.tools.nsc.backend.jvm.GenASM$AsmPhase.run(GenASM.scala:119)
      	at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1582)
      	at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1556)
      	at scala.tools.nsc.Global$Run.compileSources(Global.scala:1552)
      	at scala.tools.nsc.Global$Run.compile(Global.scala:1661)
      	at xsbt.CachedCompiler0.run(CompilerInterface.scala:90)
      	at xsbt.CachedCompiler0.run(CompilerInterface.scala:72)
      	at xsbt.CompilerInterface.run(CompilerInterface.scala:26)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:73)
      	at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:35)
      	at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:29)
      	at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileScala$1$1.apply$mcV$sp(AggressiveCompile.scala:71)
      	at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:71)
      	at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:71)
      	at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:101)
      	at sbt.compiler.AggressiveCompile$$anonfun$4.compileScala$1(AggressiveCompile.scala:70)
      	at sbt.compiler.AggressiveCompile$$anonfun$4.apply(AggressiveCompile.scala:88)
      	at sbt.compiler.AggressiveCompile$$anonfun$4.apply(AggressiveCompile.scala:60)
      	at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:24)
      	at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:22)
      	at sbt.inc.Incremental$.cycle(Incremental.scala:40)
      	at sbt.inc.Incremental$.compile(Incremental.scala:25)
      	at sbt.inc.IncrementalCompile$.apply(Compile.scala:20)
      	at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:96)
      	at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:44)
      	at sbt.compiler.AggressiveCompile.apply(AggressiveCompile.scala:31)
      	at sbt.Compiler$.apply(Compiler.scala:79)
      	at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:572)
      	at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:572)
      	at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:578)
      	at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:578)
      	at scala.Function1$$anonfun$compose$1.apply(Function1.scala:49)
      	at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311)
      	at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311)
      	at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:41)
      	at sbt.std.Transform$$anon$5.work(System.scala:71)
      	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232)
      	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232)
      	at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
      	at sbt.Execute.work(Execute.scala:238)
      	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232)
      	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232)
      	at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
      	at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      	at java.lang.Thread.run(Thread.java:722)
      [error] (compile:compile) java.lang.ArrayIndexOutOfBoundsException: 0
      >
      

        Issue Links

          Activity

          Hide
          Jason Zaugg added a comment - - edited

          Possible dup of https://issues.scala-lang.org/browse/SI-5604.

          Hmmm, on second thoughts probably not..

          Show
          Jason Zaugg added a comment - - edited Possible dup of https://issues.scala-lang.org/browse/SI-5604 . Hmmm, on second thoughts probably not..
          Hide
          Vlad Ureche added a comment - - edited

          Seems to be an interplay of inliner + dead code elimination:

          $ ../scala-trunk/build/quick/bin/scalac -version
          Scala compiler version 2.10.1-20130117-000838-b17980666d -- Copyright 2002-2013, LAMP/EPFL
          
          $ ../scala-trunk/build/quick/bin/scalac -Ydead-code src/main/scala/Test.scala -d target/scala-2.10/classes/
          
          $ ../scala-trunk/build/quick/bin/scalac -Yinline src/main/scala/Test.scala -d target/scala-2.10/classes/
          
          $ ../scala-trunk/build/quick/bin/scalac -Ydead-code -Yinline src/main/scala/Test.scala -d target/scala-2.10/classes/
          error: 
               while compiling: src/main/scala/Test.scala
                  during phase: jvm
               library version: version 2.10.1-20130117-000838-b17980666d
              compiler version: version 2.10.1-20130117-000838-b17980666d
            reconstructed args: -d target/scala-2.10/classes/ -Ydead-code -Yinline
          
            last tree to typer: TypeTree(trait App)
                        symbol: trait App in package scala (flags: <interface> abstract <trait> <lateinterface>)
             symbol definition: abstract trait App extends DelayedInit
                           tpe: App
                 symbol owners: trait App -> package scala
                context owners: object Test -> package <empty>
          
          == Enclosing template or block ==
          
          ...
          
          == Expanded type of tree ==
          
          TypeRef(TypeSymbol(abstract trait App extends DelayedInit))
          
          uncaught exception during compilation: java.lang.ArrayIndexOutOfBoundsException
          error: java.lang.ArrayIndexOutOfBoundsException: 0
          	at scala.tools.asm.Frame.merge(Unknown Source)
          	at scala.tools.asm.Frame.merge(Unknown Source)
          	at scala.tools.asm.MethodWriter.visitMaxs(Unknown Source)
          	at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genMethod(GenASM.scala:1565)
          	at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder$$anonfun$genClass$5.apply(GenASM.scala:1398)
          	at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder$$anonfun$genClass$5.apply(GenASM.scala:1398)
          	at scala.collection.immutable.List.foreach(List.scala:309)
          	at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genClass(GenASM.scala:1398)
          	at scala.tools.nsc.backend.jvm.GenASM$AsmPhase.run(GenASM.scala:119)
          	at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1582)
          	at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1556)
          	at scala.tools.nsc.Global$Run.compileSources(Global.scala:1552)
          	at scala.tools.nsc.Global$Run.compile(Global.scala:1661)
          	at scala.tools.nsc.Driver.doCompile(Driver.scala:33)
          	at scala.tools.nsc.Main$.doCompile(Main.scala:79)
          	at scala.tools.nsc.Driver.process(Driver.scala:54)
          	at scala.tools.nsc.Driver.main(Driver.scala:67)
          	at scala.tools.nsc.Main.main(Main.scala)
          
          Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
          	at scala.tools.asm.Frame.merge(Unknown Source)
          	at scala.tools.asm.Frame.merge(Unknown Source)
          	at scala.tools.asm.MethodWriter.visitMaxs(Unknown Source)
          	at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genMethod(GenASM.scala:1565)
          	at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder$$anonfun$genClass$5.apply(GenASM.scala:1398)
          	at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder$$anonfun$genClass$5.apply(GenASM.scala:1398)
          	at scala.collection.immutable.List.foreach(List.scala:309)
          	at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genClass(GenASM.scala:1398)
          	at scala.tools.nsc.backend.jvm.GenASM$AsmPhase.run(GenASM.scala:119)
          	at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1582)
          	at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1556)
          	at scala.tools.nsc.Global$Run.compileSources(Global.scala:1552)
          	at scala.tools.nsc.Global$Run.compile(Global.scala:1661)
          	at scala.tools.nsc.Driver.doCompile(Driver.scala:33)
          	at scala.tools.nsc.Main$.doCompile(Main.scala:79)
          	at scala.tools.nsc.Driver.process(Driver.scala:54)
          	at scala.tools.nsc.Driver.main(Driver.scala:67)
          	at scala.tools.nsc.Main.main(Main.scala)
          
          
          Show
          Vlad Ureche added a comment - - edited Seems to be an interplay of inliner + dead code elimination: $ ../scala-trunk/build/quick/bin/scalac -version Scala compiler version 2.10.1-20130117-000838-b17980666d -- Copyright 2002-2013, LAMP/EPFL $ ../scala-trunk/build/quick/bin/scalac -Ydead-code src/main/scala/Test.scala -d target/scala-2.10/classes/ $ ../scala-trunk/build/quick/bin/scalac -Yinline src/main/scala/Test.scala -d target/scala-2.10/classes/ $ ../scala-trunk/build/quick/bin/scalac -Ydead-code -Yinline src/main/scala/Test.scala -d target/scala-2.10/classes/ error: while compiling: src/main/scala/Test.scala during phase: jvm library version: version 2.10.1-20130117-000838-b17980666d compiler version: version 2.10.1-20130117-000838-b17980666d reconstructed args: -d target/scala-2.10/classes/ -Ydead-code -Yinline last tree to typer: TypeTree(trait App) symbol: trait App in package scala (flags: <interface> abstract <trait> <lateinterface>) symbol definition: abstract trait App extends DelayedInit tpe: App symbol owners: trait App -> package scala context owners: object Test -> package <empty> == Enclosing template or block == ... == Expanded type of tree == TypeRef(TypeSymbol(abstract trait App extends DelayedInit)) uncaught exception during compilation: java.lang.ArrayIndexOutOfBoundsException error: java.lang.ArrayIndexOutOfBoundsException: 0 at scala.tools.asm.Frame.merge(Unknown Source) at scala.tools.asm.Frame.merge(Unknown Source) at scala.tools.asm.MethodWriter.visitMaxs(Unknown Source) at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genMethod(GenASM.scala:1565) at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder$$anonfun$genClass$5.apply(GenASM.scala:1398) at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder$$anonfun$genClass$5.apply(GenASM.scala:1398) at scala.collection.immutable.List.foreach(List.scala:309) at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genClass(GenASM.scala:1398) at scala.tools.nsc.backend.jvm.GenASM$AsmPhase.run(GenASM.scala:119) at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1582) at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1556) at scala.tools.nsc.Global$Run.compileSources(Global.scala:1552) at scala.tools.nsc.Global$Run.compile(Global.scala:1661) at scala.tools.nsc.Driver.doCompile(Driver.scala:33) at scala.tools.nsc.Main$.doCompile(Main.scala:79) at scala.tools.nsc.Driver.process(Driver.scala:54) at scala.tools.nsc.Driver.main(Driver.scala:67) at scala.tools.nsc.Main.main(Main.scala) Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at scala.tools.asm.Frame.merge(Unknown Source) at scala.tools.asm.Frame.merge(Unknown Source) at scala.tools.asm.MethodWriter.visitMaxs(Unknown Source) at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genMethod(GenASM.scala:1565) at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder$$anonfun$genClass$5.apply(GenASM.scala:1398) at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder$$anonfun$genClass$5.apply(GenASM.scala:1398) at scala.collection.immutable.List.foreach(List.scala:309) at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genClass(GenASM.scala:1398) at scala.tools.nsc.backend.jvm.GenASM$AsmPhase.run(GenASM.scala:119) at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1582) at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1556) at scala.tools.nsc.Global$Run.compileSources(Global.scala:1552) at scala.tools.nsc.Global$Run.compile(Global.scala:1661) at scala.tools.nsc.Driver.doCompile(Driver.scala:33) at scala.tools.nsc.Main$.doCompile(Main.scala:79) at scala.tools.nsc.Driver.process(Driver.scala:54) at scala.tools.nsc.Driver.main(Driver.scala:67) at scala.tools.nsc.Main.main(Main.scala)
          Hide
          Vlad Ureche added a comment -

          Also affects 2.11.0-SNAPSHOT:

          > 
          > ++ 2.11.0-SNAPSHOT compile
          Setting version to 2.11.0-SNAPSHOT
          [info] Set current project to default-5d6c1b (in build file:/mnt/data-local/Work/Workspace/dev/backend-bug/)
          [info] Compiling 1 Scala source to /mnt/data-local/Work/Workspace/dev/backend-bug/target/scala-2.11.0-SNAPSHOT/classes...
          [error] 
          [error]      while compiling: /mnt/data-local/Work/Workspace/dev/backend-bug/src/main/scala/Test.scala
          [error]         during phase: jvm
          [error]      library version: version 2.11.0-20130202-121752-e67a039ec2
          [error]     compiler version: version 2.11.0-20130202-121752-e67a039ec2
          [error]   reconstructed args: -d /mnt/data-local/Work/Workspace/dev/backend-bug/target/scala-2.11.0-SNAPSHOT/classes -Ydead-code -optimise -classpath /mnt/data-local/Work/Workspace/dev/backend-bug/target/scala-2.11.0-SNAPSHOT/classes -Yinline -Yclosure-elim -Yinline-handlers -bootclasspath /usr/lib/jvm/java-7-oracle/jre/lib/resources.jar:/usr/lib/jvm/java-7-oracle/jre/lib/rt.jar:/usr/lib/jvm/java-7-oracle/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jsse.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jce.jar:/usr/lib/jvm/java-7-oracle/jre/lib/charsets.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jfr.jar:/usr/lib/jvm/java-7-oracle/jre/classes:/home/sun/.sbt/boot/scala-2.11.0-SNAPSHOT/lib/scala-library.jar
          
          Show
          Vlad Ureche added a comment - Also affects 2.11.0-SNAPSHOT: > > ++ 2.11.0-SNAPSHOT compile Setting version to 2.11.0-SNAPSHOT [info] Set current project to default-5d6c1b (in build file:/mnt/data-local/Work/Workspace/dev/backend-bug/) [info] Compiling 1 Scala source to /mnt/data-local/Work/Workspace/dev/backend-bug/target/scala-2.11.0-SNAPSHOT/classes... [error] [error] while compiling: /mnt/data-local/Work/Workspace/dev/backend-bug/src/main/scala/Test.scala [error] during phase: jvm [error] library version: version 2.11.0-20130202-121752-e67a039ec2 [error] compiler version: version 2.11.0-20130202-121752-e67a039ec2 [error] reconstructed args: -d /mnt/data-local/Work/Workspace/dev/backend-bug/target/scala-2.11.0-SNAPSHOT/classes -Ydead-code -optimise -classpath /mnt/data-local/Work/Workspace/dev/backend-bug/target/scala-2.11.0-SNAPSHOT/classes -Yinline -Yclosure-elim -Yinline-handlers -bootclasspath /usr/lib/jvm/java-7-oracle/jre/lib/resources.jar:/usr/lib/jvm/java-7-oracle/jre/lib/rt.jar:/usr/lib/jvm/java-7-oracle/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jsse.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jce.jar:/usr/lib/jvm/java-7-oracle/jre/lib/charsets.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jfr.jar:/usr/lib/jvm/java-7-oracle/jre/classes:/home/sun/.sbt/boot/scala-2.11.0-SNAPSHOT/lib/scala-library.jar
          Hide
          Vlad Ureche added a comment - - edited

          Seems dce eliminates a byte from the stack instead of converting it to a long:

          $ ../scala-trunk/build/quick/bin/scalac src/main/scala/Test.scala -Yinline -Xprint-icode:dce -Ystop-after:dce -Ydead-code
          $ mv Test\$.icode Test\$.icode-dce
          $ ../scala-trunk/build/quick/bin/scalac src/main/scala/Test.scala -Yinline -Xprint-icode:dce -Ystop-after:dce
          $ mv Test\$.icode Test\$.icode-nodce
          $ diff Test\$.icode-dce Test\$.icode-nodce 
          37c37
          <   locals: variable tag1, variable array1
          ---
          >   locals: variable array1, variable tag1, variable $inlThis1, variable $retVal1
          41a42,44
          >     10	THIS(Test)
          >     10	CONSTANT(null)
          >     10	DROP REF(class Null)
          45a49
          >     10	STORE_LOCAL(variable $inlThis1)
          62c66
          <     10	DROP BYTE
          ---
          >     10	CALL_PRIMITIVE(Conversion(BYTE,LONG))
          

          The breaker is here:

          <     10	DROP BYTE
          ---
          >     10	CALL_PRIMITIVE(Conversion(BYTE,LONG))
          
          Show
          Vlad Ureche added a comment - - edited Seems dce eliminates a byte from the stack instead of converting it to a long: $ ../scala-trunk/build/quick/bin/scalac src/main/scala/Test.scala -Yinline -Xprint-icode:dce -Ystop-after:dce -Ydead-code $ mv Test\$.icode Test\$.icode-dce $ ../scala-trunk/build/quick/bin/scalac src/main/scala/Test.scala -Yinline -Xprint-icode:dce -Ystop-after:dce $ mv Test\$.icode Test\$.icode-nodce $ diff Test\$.icode-dce Test\$.icode-nodce 37c37 < locals: variable tag1, variable array1 --- > locals: variable array1, variable tag1, variable $inlThis1, variable $retVal1 41a42,44 > 10 THIS(Test) > 10 CONSTANT(null) > 10 DROP REF(class Null) 45a49 > 10 STORE_LOCAL(variable $inlThis1) 62c66 < 10 DROP BYTE --- > 10 CALL_PRIMITIVE(Conversion(BYTE,LONG)) The breaker is here: < 10 DROP BYTE --- > 10 CALL_PRIMITIVE(Conversion(BYTE,LONG))
          Hide
          Jason Zaugg added a comment -

          Similar symptoms and circumstances to SI-6547, which was about box/unbox elimination.

          Show
          Jason Zaugg added a comment - Similar symptoms and circumstances to SI-6547 , which was about box/unbox elimination.
          Hide
          Vlad Ureche added a comment - - edited

          @retronym: Yes, very close, it's true. Still, the patch for SI-6547 made it to 2.10.1-SNAPSHOT, no?
          I'm currently compiling 2.10.x so I can see whether that fixes the problem.

          Show
          Vlad Ureche added a comment - - edited @retronym: Yes, very close, it's true. Still, the patch for SI-6547 made it to 2.10.1-SNAPSHOT, no? I'm currently compiling 2.10.x so I can see whether that fixes the problem.
          Hide
          Jason Zaugg added a comment -

          Yep, that patch is in there. Perhaps it's a variation.

          Show
          Jason Zaugg added a comment - Yep, that patch is in there. Perhaps it's a variation.
          Show
          Vlad Ureche added a comment - https://github.com/scala/scala/pull/2059

            People

            • Assignee:
              James Iry
              Reporter:
              Vlad Ureche
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development