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

fsc crash with -optimize when compiling twice #5776

Closed
scabug opened this issue May 8, 2012 · 7 comments
Closed

fsc crash with -optimize when compiling twice #5776

scabug opened this issue May 8, 2012 · 7 comments

Comments

@scabug
Copy link

scabug commented May 8, 2012

Compile with fsc -optimize the following source twice:

object Main {
  def main(args: Array[String]) {
    var l = List(1,2,3,4)
    l.sliding(2).foreach { case List(a, b) => printf("%d\n", a + b) }
  }
}

gives

lucmac:sandbox luc$ ~/Downloads/pack/bin/fsc -optimize t5776.scala 
lucmac:sandbox luc$ ~/Downloads/pack/bin/fsc -optimize t5776.scala 
error: 
     while compiling: t5776.scala
        during phase: mixin
     library version: version 2.10.0-20120515-091713-8a3ed4cc95
    compiler version: version 2.10.0-20120515-091713-8a3ed4cc95
  reconstructed args: -Ydead-code -optimise -Yinline -Yclosure-elim -Yinline-handlers

[...]

uncaught exception during compilation: java.lang.AssertionError
lucmac:sandbox luc$ 
@scabug
Copy link
Author

scabug commented May 8, 2012

Imported From: https://issues.scala-lang.org/browse/SI-5776?orig=1
Reporter: Alan Burlison (alanbur)
Assignee: @magarciaEPFL
Affected Versions: 2.10.0-M3
See #5789

@scabug
Copy link
Author

scabug commented May 15, 2012

@lrytz said:
could you please provide us a self-contained example to reproduce the error. thanks

@scabug
Copy link
Author

scabug commented May 15, 2012

Alan Burlison (alanbur) said:
Here's the code:


object Main {
def main(args: Array[String]) {
var l = List(1,2,3,4)
l.sliding(2).foreach { case List(a, b) => printf("%d\n", a + b) }
}
}

I've managed to reproduce it:

$ /pool1/rootdisk/opt/scala/scala-2.10.0-M3/bin/fsc -Xlint -optimize neme.scala
neme.scala:4: warning: dead code following this construct
l.sliding(2).foreach { case List(a, b) => printf("%d\n", a + b) }
^
one warning found
$ fsc -Xlint -optimize neme.scala
neme.scala:4: warning: dead code following this construct
l.sliding(2).foreach { case List(a, b) => printf("%d\n", a + b) }
^
error:
while compiling: neme.scala
current phase: mixin
library version: version 2.10.0-M3
compiler version: version 2.10.0-M3
reconstructed args: -Ydead-code -Ywarn-nullary-unit -optimise -Xlint -Ywarn-inaccessible -Yinline -Ywarn-nullary-override -Yclosure-elim -Ywarn-dead-code -Yinline-handlers -Ywarn-adapted-args

uncaught exception during compilation: java.lang.AssertionError
$ fsc -version
Fast Scala compiler version 2.10.0-M2 -- Copyright 2002-2011, LAMP/EPFL

What's really odd is that when it fails above I'm getting a message from the M3 fsc but I'm (apparently) using the M2 version, I assume because the M3 fsc process is still active - when I originally saw this error I'd just installed M3. I'm wondering if this isn't some sort of malign interaction of the M2 & M3 versions of fsc, is that possible? Does the fsc driver check it is talking to a matching version of the fsc server? If not, perhaps it should?

@scabug
Copy link
Author

scabug commented May 15, 2012

Alan Burlison (alanbur) said:
Added more detail - may be a fsc versioning problem?

@scabug
Copy link
Author

scabug commented May 15, 2012

Alan Burlison (alanbur) said:
Thanks for narrowing this down Lukas, I couldn't quite figure out what was going on.

@scabug
Copy link
Author

scabug commented Jul 11, 2012

@magarciaEPFL said (edited on Jul 11, 2012 11:03:02 AM UTC):
Perhaps related to #5789.

The AssertionError occurs during the mixin phase. This can be confirmed by running

fsc test.scala -optimize -Ystop-after:constructors

multiple times, no AssertionError ensues.

In contrast, running

fsc test.scala -optimize -Ystop-after:mixin

results in AssertionError every other time.

@scabug
Copy link
Author

scabug commented Aug 9, 2012

Alan Burlison (alanbur) said:
This does indeed seem to be the same issue as reported in #5789

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

1 participant