digitalmars.D.bugs - [Issue 8891] New: non-static opCall runs in initialization incorrectly
- d-bugmail puremagic.com (33/33) Oct 24 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8891
- d-bugmail puremagic.com (34/34) Oct 25 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8891
- d-bugmail puremagic.com (10/10) Oct 27 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8891
- d-bugmail puremagic.com (11/11) Oct 27 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8891
- d-bugmail puremagic.com (14/14) Oct 27 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8891
- d-bugmail puremagic.com (12/12) Nov 08 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8891
http://d.puremagic.com/issues/show_bug.cgi?id=8891 Summary: non-static opCall runs in initialization incorrectly Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: accepts-invalid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: k.hara.pg gmail.com --- Comment #0 from Kenji Hara <k.hara.pg gmail.com> 2012-10-24 22:41:21 PDT --- import core.stdc.stdio : printf; struct S { int value = 10; S opCall(int n) // non-static { printf("this.value = %d\n", this.value); // prints garbage! S s; s.value = n; return s; } } void main() { S s = 10; // calls instance opCall incorrectly } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 24 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8891 Maxim Fomin <maxim maxim-fomin.ru> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |maxim maxim-fomin.ru --- Comment #1 from Maxim Fomin <maxim 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 plt> -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 25 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8891 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #2 from Kenji Hara <k.hara.pg gmail.com> 2012-10-27 08:07:34 PDT --- https://github.com/D-Programming-Language/dmd/pull/1231 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 27 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8891 --- Comment #3 from github-bugzilla puremagic.com 2012-10-27 10:25:33 PDT --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/a4c8e8e295974e11cefa0ac9e8a10d8829efc4b7 fix Issue 8891 - non-static opCall runs in initialization incorrectly https://github.com/D-Programming-Language/dmd/commit/6f51482f15976f3407ffef19b0c1322d0d3c9a56 Merge pull request #1231 from 9rnsr/fix8891 Issue 8891 - non-static opCall runs in initialization incorrectly -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 27 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8891 yebblies <yebblies gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |yebblies gmail.com Version|D2 |D1 Summary|non-static opCall runs in |(D1 only) non-static opCall |initialization incorrectly |runs in initialization | |incorrectly --- Comment #4 from yebblies <yebblies gmail.com> 2012-10-28 04:41:14 EST --- Fixed for D2 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 27 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8891 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #5 from Kenji Hara <k.hara.pg gmail.com> 2012-11-08 09:30:01 PST --- Fixed D1: https://github.com/D-Programming-Language/dmd/commit/e0d07bf6cdc7b5b41a8eec777a89ac0178c7549c -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 08 2012