[Issue 8891] non-static opCall runs in initialization incorrectly
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Oct 25 01:24:12 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8891
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-25 01:23:56 PDT ---
(In reply to comment #0)
It seems dmd fails to push pointer to S object in case of S s = 10;
0x0000000000418559 <+1>: mov %rsp,%rbp
0x000000000041855c <+4>: sub $0x10,%rsp
0x0000000000418560 <+8>: mov $0xa,%esi
0x0000000000418565 <+13>: lea -0x8(%rbp),%rdi // %rdi is garbage
0x0000000000418569 <+17>: callq 0x418500 <_D4main1S6opCallMFiZS4main1S>
In case of S s; s.opCall(10) it makes correctly:
0x0000000000418534 <+0>: push %rbp
0x0000000000418535 <+1>: mov %rsp,%rbp
0x0000000000418538 <+4>: sub $0x10,%rsp
0x000000000041853c <+8>: mov 0x1720e(%rip),%eax <_D4main1S6__initZ>
0x0000000000418542 <+14>: mov %eax,-0x8(%rbp)
0x0000000000418545 <+17>: mov $0xa,%esi
0x000000000041854a <+22>: lea -0x8(%rbp),%rdi // %rdi is S.init
0x000000000041854e <+26>: callq 0x418500 <_D4main1S6opCallMFiZS4main1S>
opCall expects struct object to be in %esp
0x0000000000418500 <+0>: push %rbp
0x0000000000418501 <+1>: mov %rsp,%rbp
0x0000000000418504 <+4>: sub $0x20,%rsp
0x0000000000418508 <+8>: mov %esi,-0x8(%rbp)
0x000000000041850b <+11>: mov (%rdi),%esi // this.value
0x000000000041850d <+13>: movabs $0x42f758,%rdi
0x0000000000418517 <+23>: xor %eax,%eax
0x0000000000418519 <+25>: callq 0x418100 <printf at plt>
--
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