Thread overview
[Issue 4782] New: atomicOp!"+=" hangs with floating point
Sep 01, 2010
David Simcha
[Issue 4782] core.atomic.atomicLoad broken for floating point
Oct 04, 2010
David Simcha
Aug 27, 2011
David Simcha
Dec 28, 2011
David Simcha
September 01, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4782

           Summary: atomicOp!"+=" hangs with floating point
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: sean@invisibleduck.org
        ReportedBy: dsimcha@yahoo.com


--- Comment #0 from David Simcha <dsimcha@yahoo.com> 2010-09-01 07:32:14 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 04, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4782


David Simcha <dsimcha@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|atomicOp!"+=" hangs with    |core.atomic.atomicLoad
                   |floating point              |broken for floating point


--- Comment #1 from David Simcha <dsimcha@yahoo.com> 2010-10-04 12:42:16 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 27, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4782



--- Comment #2 from David Simcha <dsimcha@yahoo.com> 2011-08-27 08:47:59 PDT ---
https://github.com/D-Programming-Language/druntime/pull/61

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 28, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4782


David Simcha <dsimcha@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #3 from David Simcha <dsimcha@yahoo.com> 2011-12-28 06:29:30 PST ---
This has been fixed for a few releases, but was never closed.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------