Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contradiction: had an empty possible set indicating an uninitialized location #8306

Closed
scabug opened this issue Feb 18, 2014 · 9 comments
Closed

Comments

@scabug
Copy link

scabug commented Feb 18, 2014

When compiling scala-io compiler crashes with:

[info] java.lang.AssertionError: assertion failed: Contradiction: had an empty possible set indicating an uninitialized location
[info] 	at scala.tools.nsc.backend.opt.ConstantOptimization$ConstantOptimizer$Possible.<init>(ConstantOptimization.scala:166)
[info] 	at scala.tools.nsc.backend.opt.ConstantOptimization$ConstantOptimizer.interpretLast(ConstantOptimization.scala:500)
[info] 	at scala.tools.nsc.backend.opt.ConstantOptimization$ConstantOptimizer.interpretBlock(ConstantOptimization.scala:552)
[info] 	at scala.tools.nsc.backend.opt.ConstantOptimization$ConstantOptimizer.interpretMethod(ConstantOptimization.scala:610)
[info] 	at scala.tools.nsc.backend.opt.ConstantOptimization$ConstantOptimizer.optimizeMethod(ConstantOptimization.scala:65)
[info] 	at scala.tools.nsc.backend.opt.ConstantOptimization$ConstantOptimizer.optimizeClass(ConstantOptimization.scala:57)
[info] 	at scala.tools.nsc.backend.opt.ConstantOptimization$ConstantOptimizationPhase.apply(ConstantOptimization.scala:49)
[info] 	at scala.tools.nsc.backend.icode.ICodes$ICodePhase$$anonfun$apply$2.apply(ICodes.scala:123)
[info] 	at scala.tools.nsc.backend.icode.ICodes$ICodePhase$$anonfun$apply$2.apply(ICodes.scala:123)

It can be reproduced with dbuild using this branch: https://github.com/gkossakowski/community-builds/tree/play

@scabug
Copy link
Author

scabug commented Feb 18, 2014

@scabug
Copy link
Author

scabug commented Feb 18, 2014

@gkossakowski said:
I'll be trying to isolate and minimize this.

@scabug
Copy link
Author

scabug commented Feb 18, 2014

@retronym said:
Yay for dbuild!

You might also be able to workaround (to find other problems) with -Yconst-opt:false.

@scabug
Copy link
Author

scabug commented Feb 19, 2014

@gkossakowski said:
Minimized (compile with -optimize):

class Si8306 {
	def foo: Int = 123
	lazy val extension: Int =
    	foo match {
      		case idx if idx != -1 => 15
      		case _ => 17
    	}
}

Lazy val is important here. If I change it to val or def then the crash is gone.

@scabug
Copy link
Author

scabug commented Feb 19, 2014

@magarciaEPFL said:
Just checked, the new optimizer http://magarciaepfl.github.io/scala/ isn't prone to this bug.

@scabug
Copy link
Author

scabug commented Feb 19, 2014

@gkossakowski said:
Thanks for checking!

@scabug
Copy link
Author

scabug commented Feb 19, 2014

@retronym said:
patmat emits a switch with just a default case:

(x1: Int) match {
  case _ => if (x1.!=(-1)) 15 else17
}

That's enough to lead to an empty set of integer tags in the SWITCH in the icode tree, which trips the assertion in constant optimization.

We could change one or more of patmat, genicode, and constopt to improve the situation.

@scabug
Copy link
Author

scabug commented Feb 19, 2014

@gkossakowski said:
I think patmat is fine here. Switch with just default case should be supported by the backend. I think the same goes for genicode.

@scabug scabug closed this as completed Feb 19, 2014
@scabug
Copy link
Author

scabug commented Feb 19, 2014

@adriaanm said:
scala/scala#3560

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants