www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4782] New: atomicOp!"+=" hangs with floating point

reply d-bugmail puremagic.com writes:
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



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: -------
Sep 01 2010
next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Oct 04 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4782




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: -------
Aug 27 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4782


David Simcha <dsimcha yahoo.com> changed:

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



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: -------
Dec 28 2011