problem compiling with optimizations enabled
bearophile
bearophileHUGS at lycos.com
Sat Mar 31 17:22:35 PDT 2012
darkstalker:
> Is this a bug? or something wrong in my code?
Congratulations, it's another compiler bug.
On Windows 32 bit this code behaves in another way, it doesn't crash:
import std.stdio;
void main() {
for (idouble j = -2i; j <= 2i; j += 0.125i) {
for (double r = -2; r <= 2; r += 0.0625) {
cdouble c = r + j;
writeln(c.re, " ", c.im);
}
}
}
Without -O:
-2 -2
-1.9375 -2
-1.875 -2
-1.8125 -2
-1.75 -2
...
1.75 2
1.8125 2
1.875 2
1.9375 2
2 2
With -O:
-0 -9.88131e-324
-0 -9.88131e-324
-0 -9.88131e-324
-0 -9.88131e-324
-0 -9.88131e-324
-0 -9.88131e-324
-0 -9.88131e-324
...
Bye,
bearophile
More information about the Digitalmars-d
mailing list