[Issue 8923] Destructors of struct members get called at the wrong point
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Oct 31 11:52:00 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8923
Maxim Fomin <maxim at maxim-fomin.ru> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |maxim at maxim-fomin.ru
--- Comment #1 from Maxim Fomin <maxim at maxim-fomin.ru> 2012-10-31 11:51:58 PDT ---
It seems that dmd doesn't pass allocated value correctly. In this case it emits
in main function code:
callq <_d_allocmemory>
movq $0x0,(%rax)
movb $0x0,0x8(%rax)
lea -0x8(%rbp),%rax
xor %rcx,%rcx
mov %rcx,(%rax)
mov %rax,%rdi
So, allocated value is overwritten and destructor gets incorrect pointer in
%rdi. However, if the case is simplified to one level (replace S s; with
DestructorCounter s;) dmd emits correct code:
callq <_d_allocmemory>
movq $0x0,(%rax)
movb $0x0,0x8(%rax)
mov %rax,-0x8(%rbp)
lea -0x8(%rbp),%rax
xor %rcx,%rcx
mov %rax,%rdi
Now %rdi points to allocated memory. Probably, because S field destructor
doesn't access destructorCalled object forces dmd to pass invalid value.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list