www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12823] New: atomicLoad ABI broken for structs returned in fp

https://issues.dlang.org/show_bug.cgi?id=12823

          Issue ID: 12823
           Summary: atomicLoad ABI broken for structs returned in fp
                    registers
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: code klickverbot.at

Using DMD 2.065 on Linux x86_64, this
---
struct Foo { double d; }
shared foo = Foo(2.0);
void main() {
    import core.atomic, std.stdio;
    writeln(atomicLoad(foo));
}
---
prints
---
Foo(3.22526e-319)
---

The issue here is is that Foo is passed in floating point registers under the
AMD64 ABI, yet the druntime code only special-cases "raw" floating point
numbers to be returned correctly.

--
May 30 2014