Bug 4782 – core.atomic.atomicLoad broken for floating point

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2010-09-01T07:32:00Z
Last change time
2011-12-28T06:29:30Z
Assigned to
sean
Creator
dsimcha

Comments

Comment #0 by dsimcha — 2010-09-01T07:32:14Z
The following program hangs: import core.atomic; void main() { float num1 = 1; float num2 = 1; atomicOp!"+="(num1, num2); } If I change the operation to any other arithmetic operation, or change the floats to doubles, it still hangs. If I change num1 and num2 to ints or longs, it works.
Comment #1 by dsimcha — 2010-10-04T12:42:16Z
I looked into this one a little. The root cause is actually that atomicLoad is broken for floating point values. Floating point values are supposed to be returned in floating point registers, not x86 registers. Here's an example demonstrating this issue. import std.stdio; void main() { double foo = 2; writeln(atomicLoad!(msync.raw)(foo)); // -nan } // Copy/paste core.atomic here and remove module declaration, since atomic load is private.
Comment #2 by dsimcha — 2011-08-27T08:47:59Z
Comment #3 by dsimcha — 2011-12-28T06:29:30Z
This has been fixed for a few releases, but was never closed.