digitalmars.D.bugs - [Issue 18758] New: RVO ignores asm writing to return value
- d-bugmail puremagic.com (34/34) Apr 13 2018 https://issues.dlang.org/show_bug.cgi?id=18758
https://issues.dlang.org/show_bug.cgi?id=18758 Issue ID: 18758 Summary: RVO ignores asm writing to return value Product: D Version: D2 Hardware: All OS: Windows Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: r.sagitario gmx.de This code assert for both x86 and x64: struct S { int x; int y; int z; } S foo() { S s; asm { mov EAX, 42; mov [s], EAX; } return s; } void main() { S s; s = foo(); assert(s.x == 42); } A workaround seems to be to assign the return value to a temporary first, but this seems brittle when optimizations might remove the unnecessary copy. --
Apr 13 2018