Bug 6042 – registers not preserved across method call
Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2011-05-21T05:36:00Z
Last change time
2011-08-28T08:40:42Z
Assigned to
nobody
Creator
code
Comments
Comment #0 by code — 2011-05-21T05:36:44Z
void destroysXMM1(float a, float b) {
}
void assertSame(float a, float b) {
assert(a == b);
}
class Bug {
@property float xval() const {
destroysXMM1(0.0f, 0.0f);
return 2.0f;
}
void show() {
assertSame(xval, xval);
}
}
void main() {
auto bug = new Bug();
bug.show();
}
----
This is the generated code.
mov 0xfffffffffffffff8(%rbp),%rdi
mov (%rdi),%rax
rex64 callq *0x30(%rax)
movsd %xmm0,0xfffffffffffffff0(%rbp)
movsd 0xfffffffffffffff0(%rbp),%xmm1
mov 0xfffffffffffffff8(%rbp),%rdi
mov (%rdi),%rcx
rex64 callq *0x30(%rcx)
callq 40162c <_D3bug10assertSameFffZv>
The return value of the first parameter evaluation is moved to xmm1 before the other parameter gets evaluated.
Comment #1 by code — 2011-06-21T11:08:30Z
*** This issue has been marked as a duplicate of issue 6189 ***
Comment #2 by code — 2011-08-28T08:40:42Z
*** This issue has been marked as a duplicate of issue 6270 ***