[Issue 9931] Bus error interfacing with C function returning structs with floats

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 17 02:58:15 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9931



--- Comment #10 from John Colvin <john.loughran.colvin at gmail.com> 2013-04-17 10:58:11 BST ---
(In reply to comment #9)
> (In reply to comment #7)
> > 0x0000267c <D4test3barFZS4test3Foo+20>: call   0x26a0 <foo>
> > 0x00002681 <D4test3barFZS4test3Foo+25>: add    $0xc,%esp
> > 0x00002684 <D4test3barFZS4test3Foo+28>: mov    %eax,%esi // <- EAX is trashed
> > 0x00002686 <D4test3barFZS4test3Foo+30>: mov    -0x4(%ebp),%edi
> > 0x00002689 <D4test3barFZS4test3Foo+33>: movsl  %ds:(%esi),%es:(%edi)
> > 0x0000268a <D4test3barFZS4test3Foo+34>: movsl  %ds:(%esi),%es:(%edi)
> > 0x0000268b <D4test3barFZS4test3Foo+35>: movsl  %ds:(%esi),%es:(%edi)
> 
> You're reading it the wrong way around, at&t is src,des

Sorry, my mistake, I misunderstood you. Martin, you are completely correct. Dmd
is presuming that the pointer to the struct is returned in eax but foo sets
that to 0, as it is entitled to. Hence movs is reading from 0.

-- 
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