[Issue 14779] New: incorrect addressing of arguments in require/in-contract
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Jul 7 01:39:06 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14779
Issue ID: 14779
Summary: incorrect addressing of arguments in
require/in-contract
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Keywords: wrong-code
Severity: regression
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: code at dawg.eu
cat > bug.d << CODE
class Foo
{
final @property void value(int val)
in
{
assert(val == 0);
}
body
{
}
}
void main()
{
auto foo = new Foo();
foo.value = 0;
}
CODE
dmd -run bug
----
core.exception.AssertError at bug.d(6): Assertion failure
----
Seems like the addressing the require function (in contract) is wrong.
This only affects master, not 2.068.0-b1.
Old ASM:
mov qword ptr [rbp-10H], rdi ; 0008 _ 48: 89. 7D, F0
mov dword ptr [rbp-8H], esi ; 000C _ 89. 75, F8
lea rdi, [rbp-10H] ; 000F _ 48: 8D. 7D, F0
call _D3bug3Foo5valueMFNdiZ9__requireMFZv ; 0013 _ E8,
00000000(rel)
_D3bug3Foo5valueMFNdiZ9__requireMFZv PROC
push rbp ; 0000 _ 55
mov rbp, rsp ; 0001 _ 48: 8B. EC
sub rsp, 16 ; 0004 _ 48: 83. EC, 10
cmp dword ptr [rdi+8H], 0 ; 0008 _ 83. 7F, 08, 00
New ASM:
mov qword ptr [rbp-10H], rdi ; 0008 _ 48: 89. 7D, F0
mov dword ptr [rbp-8H], esi ; 000C _ 89. 75, F8
call _D3bug3Foo5valueMFNdiZ9__requireMFZv ; 000F _ E8,
00000000(rel)
_D3bug3Foo5valueMFNdiZ9__requireMFZv PROC
push rbp ; 0000 _ 55
mov rbp, rsp ; 0001 _ 48: 8B. EC
sub rsp, 16 ; 0004 _ 48: 83. EC, 10
mov qword ptr [rbp-8H], rdi ; 0008 _ 48: 89. 7D, F8
cmp dword ptr [rbp], 0 ; 000C _ 83. 7D, 00, 00
--
More information about the Digitalmars-d-bugs
mailing list