```
void main()
{
real x = 1;
real y = x / 0;
assert(y is real.infinity);
}
```
This passes when compiled without optimizations and fails when compiled with -O. When optimizations are enabled y is evaluated as NaN (probaby because of const-folding?)
I don't know if this is bug or feature and if it should be fixed / changed at all but creating bugzilla issue just so that it won't be as much of surprise to others :)
Comment #1 by clugdbug — 2014-11-17T11:25:01Z
This seems related to bug 5908. The fix there did not fix all of the issues with division by zero.
This is not a regression, though. The bug applied also to DMD 2.063.
x/0 is NaN only if x is 0.0 or infinity. Otherwise the result should be +-real.infinity.
Comment #2 by yebblies — 2014-11-17T12:02:14Z
I can't reproduce with master on win32. I assume this is with master?
Comment #3 by clugdbug — 2014-11-17T12:11:31Z
It is happening on linux64. Would be interesting if it turned out to be Linux-only, or 64bit only.
Comment #4 by public — 2014-11-18T02:57:03Z
DMD git master, linux. Happens with both -m64 and -m32
Comment #5 by dlang-bugzilla — 2017-06-26T13:48:07Z