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


Don <clugd...@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #2 from Don <clugd...@yahoo.com.au> 2010-03-12 05:51:40 PST ---
PATCH: The struct ss is passed in EAX. The backend wants ss.b. It sees that
ss.b is already in EAX, so it doesn't reload it into AX. But AX actually
contains ss.a.
Solution: Disable the optimisation in cod1.loaddata() if it's a subsequent
member of the struct.

Index: cod1.c
===================================================================
--- cod1.c    (revision 413)
+++ cod1.c    (working copy)
@@ -3453,6 +3453,7 @@
     // See if we can use register that parameter was passed in
     if (regcon.params && e->EV.sp.Vsym->Sclass == SCfastpar &&
     regcon.params & mask[e->EV.sp.Vsym->Spreg] &&
+    !(e->Eoper == OPvar && e->EV.sp.Voffset > 0) && // Must be at the base of
that variable
     sz <= REGSIZE)            // make sure no 'paint' to a larger size
happened
     {
     reg = e->EV.sp.Vsym->Spreg;

=========================
Reduced test case:
=========================
struct Snake {
    short a, b;
}

void venom(short dd)
{
  assert(dd == 'B');
}

void serpent( Snake ss ) {
  venom(ss.b);
}

void main(){
    Snake s;
    s.a = 'A';
    s.b = 'B';
    serpent( s );
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to