Le lundi 23 janvier 2012 01:53:21, Daniel Glöckner a écrit :
> On Mon, Jan 23, 2012 at 12:14:58AM +0100, grischka wrote:
> > Thomas Preud'homme wrote:
> > >>Similar bug happens for i386 for example with
> > >>
> > >>     double bar(double a, double b, double c, double d);
> > >>     double foo (double *p)
> > >>     {
> > >>     
> > >>         return bar(p[1], p[2], p[3], p[4]);
> > >>     
> > >>     }
> > >>
> > >>which produces
> > >>
> > >>   49:   8b 5d fc                mov    0xfffffffc(%ebp),%ebx
> > >>   4c:   dd 03                   fldl   (%ebx)
> > >>
> > >>It should never use %ebx.  Hope this helps.
> > >
> > >Are you working on a fix? I looked for some use of ebx in i386-*
> > >and didn't see any reference to ebx or rbx which looked
> > >suspicious. Would it be a wrong construction of an instruction?
> > 
> > Good question ;)
> 
> Fixed in mob
Great, thanks a lot.
> 
>   Daniel
Shouldn't the same fix (Cf attached file) be applied for x86-64? As I'm not 
sure 
about the answer I didn't dare to commit the change.

Best regards,

Thomas Preud'homme
> 
> _______________________________________________
> Tinycc-devel mailing list
> Tinycc-devel@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
diff --git a/x86_64-gen.c b/x86_64-gen.c
index 4d2521d..0b3db22 100644
--- a/x86_64-gen.c
+++ b/x86_64-gen.c
@@ -367,8 +367,10 @@ void load(int r, SValue *sv)
             v1.type.t = VT_PTR;
             v1.r = VT_LOCAL | VT_LVAL;
             v1.c.ul = fc;
-            load(r, &v1);
             fr = r;
+            if (!(reg_classes[fr] & RC_INT))
+                fr = get_reg(RC_INT);
+            load(fr, &v1);
         }
         ll = 0;
         if ((ft & VT_BTYPE) == VT_FLOAT) {

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to