Optimizing with dmd disables floating point exceptions

KennyTM~ kennytm at gmail.com
Thu Apr 28 23:46:54 PDT 2011


On Apr 29, 11 14:27, Walter Bright wrote:
> That's because the a/=1.0L; is a dead assignment and is removed by the
> optimizer.

I'd say it's a wrong-code bug.

-------------------------------------
import std.math, std.stdio;
void main() {
      auto a = 1.0, b = 0.0;
      writeln(a);
      writeln(ieeeFlags.divByZero);
      auto c = a / b;    // <-- this is no longer dead right?
      writeln(c);
      writeln(ieeeFlags.divByZero);
}
-------------------------------------
1
false
9.50035e-306
false
-------------------------------------


More information about the Digitalmars-d mailing list