Uploaded image for project: 'Scala Programming Language'
  1. Scala Programming Language
  2. SI-8334

Crash in dead code elimination: could not find init

    Details

    • Type: Bug
    • Status: CLOSED
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Scala 2.12.0-M4
    • Component/s: None
    • Labels:
      None

      Description

      Rex ran into it while working on optimizing List operations. Minimized version looks like this:

      package abc
       
      class Bar(head: AnyRef)
       
      class A {
        @inline
        final def mapp(f: AnyRef => AnyRef): AnyRef = {
          new Bar(f(null))
        }
        def f: Boolean = {
          mapp (_ => return false)
          true
        }
      }
      

      when compiled with -optimize we get:

      error: could not find init in: abc.A.f
      error: scala.reflect.internal.FatalError:
        could not find init in: abc.A.f
           while compiling: OptimizerCrash.scala
              during phase: dce
      [..]
       
      == Source file context for tree position ==
       
          11   }
          12   def f: Boolean = {
          13     mapp (_ => return false)
          14     true
          15   }
          16 }
      	at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:57)
      	at scala.tools.nsc.Global.abort(Global.scala:268)
      	at scala.tools.nsc.backend.opt.DeadCodeElimination$DeadCode.scala$tools$nsc$backend$opt$DeadCodeElimination$DeadCode$$findInstruction(DeadCodeElimination.scala:432)
      	at scala.tools.nsc.backend.opt.DeadCodeElimination$DeadCode.mark(DeadCodeElimination.scala:261)
      	at scala.tools.nsc.backend.opt.DeadCodeElimination$DeadCode.dieCodeDie(DeadCodeElimination.scala:103)
      	at scala.tools.nsc.backend.opt.DeadCodeElimination$DeadCode$$anonfun$analyzeClass$2.apply(DeadCodeElimination.scala:60)
      	at scala.tools.nsc.backend.opt.DeadCodeElimination$DeadCode$$anonfun$analyzeClass$2.apply(DeadCodeElimination.scala:58)
      

        Attachments

          Activity

            People

            • Assignee:
              rytz Lukas Rytz
              Reporter:
              grek Grzegorz Kossakowski
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: