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

dead-code elimination too aggressive: no divide-by-zero error thrown for (1 / x): Unit #8601

Closed
scabug opened this issue May 18, 2014 · 4 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented May 18, 2014

% qbin/scala -Ydead-code
Welcome to Scala version 2.12.0-20140517-230840-07399f255c (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0-ea).
Type in expressions to have them evaluated.
Type :help for more information.

scala> class C { def f(x: Int): Unit = 100 / x}
defined class C

scala> :javap C
 ...
{
  public void f(int);
    descriptor: (I)V
    flags: ACC_PUBLIC
    Code:
      stack=0, locals=2, args_size=2
         0: return
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0       1     0  this   LC;
            0       1     1     x   I
      LineNumberTable:
        line 7: 0

}

scala> new C().f(0)
 // no exception thrown !
@scabug
Copy link
Author

scabug commented May 18, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8601?orig=1
Reporter: @retronym
Affected Versions: 2.11.0
See #7607

@scabug
Copy link
Author

scabug commented May 18, 2014

@retronym said:
As discovered in Scalaz by the Community Build: https://jenkins-dbuild.typesafe.com:8499/job/Community-2.11.x-manual/23/

@scabug
Copy link
Author

scabug commented May 18, 2014

@retronym said:
scala/scala#3760

1 similar comment
@scabug
Copy link
Author

scabug commented May 19, 2014

@retronym said:
scala/scala#3760

@scabug scabug closed this as completed May 20, 2014
@scabug scabug added this to the 2.11.2 milestone Apr 7, 2017
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