[Issue 19333] New: Add float, double and real overloads over volatileLoad and volatileStore
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Oct 25 20:34:14 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=19333
Issue ID: 19333
Summary: Add float, double and real overloads over volatileLoad
and volatileStore
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: ibuclaw at gdcproject.org
These might be useful for the buggy std.math tests where clever compilers don't
raise FE flags if it is able to const-fold the value at compile time - such as
GDC or LDC
For example, the following test returns false for `ieeeFlags.inexact` with
optimizations on.
```
() { x = 1; x += 0.1; },
() => ieeeFlags.inexact
```
So we would benefit from instead writing it as:
```
() { volatileStore(&x, 1); volatileStore(&x, x + 0.1); }
() => ieeeFlags.inexact
```
Which should be guaranteed to be true if the compiler adheres to correct
volatile semantics.
--
More information about the Digitalmars-d-bugs
mailing list