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


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

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


--- Comment #7 from Don <clugd...@yahoo.com.au> 2010-07-26 13:03:13 PDT ---
There's probably a simpler way to patch this. What I've done is find the first
non-ref parameter, and set __argptr off it.

Index: func.c
===================================================================
--- func.c    (revision 588)
+++ func.c    (working copy)
@@ -1367,18 +1367,32 @@
 #else
                 Type *t = argptr->type;
                 VarDeclaration *p;
-                unsigned offset;
-
+                unsigned offset = 0;
                 Expression *e1 = new VarExp(0, argptr);
+                // Find the last non-ref parameter
                 if (parameters && parameters->dim)
-                    p = (VarDeclaration *)parameters->data[parameters->dim -
1];
+                {
+                    int lastNonref = parameters->dim -1;
+                    p = (VarDeclaration *)parameters->data[lastNonref];
+                    while (p->storage_class & (STCout | STCref))
+                    {
+                        --lastNonref;
+                        offset += PTRSIZE;
+                        if (lastNonref < 0)
+                        {
+                            p = v_arguments;
+                            break;
+                        }
+                        p = (VarDeclaration *)parameters->data[lastNonref];
+                    }
+                }
                 else
-                    p = v_arguments;            // last parameter is
_arguments[]
+                    p = v_arguments;
                 if (p->storage_class & STClazy)
                     // If the last parameter is lazy, it's the size of a
delegate
-                    offset = PTRSIZE * 2;
+                    offset += PTRSIZE * 2;
                 else
-                    offset = p->type->size();
+                    offset += p->type->size();
                 offset = (offset + 3) & ~3;     // assume stack aligns on 4
                 Expression *e = new SymOffExp(0, p, offset);
                 e->type = Type::tvoidptr;

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

Reply via email to