]> Cypherpunks repositories - gostls13.git/commitdiff
fix possible infinite recursion in eqtype.
authorRuss Cox <rsc@golang.org>
Thu, 29 Jan 2009 00:42:26 +0000 (16:42 -0800)
committerRuss Cox <rsc@golang.org>
Thu, 29 Jan 2009 00:42:26 +0000 (16:42 -0800)
don't use intermediate register to move
32-or-fewer-bit immediate constants
into memory.

R=ken
OCL=23726
CL=23726

src/cmd/6g/gsubr.c
src/cmd/gc/subr.c

index 6934c6f30cef423c37346e05063546cf286b6d87..86ba52c3fe0165ee49b95e6437629e3a71d66010 100644 (file)
@@ -554,7 +554,9 @@ gmove(Node *f, Node *t)
                goto st;
 
        st:
-               if(f->op == OCONST) {
+               // 64-bit immediates only allowed for move into registers.
+               // this is not a move into a register.
+               if(f->op == OCONST || (f->op == OLITERAL && !t64)) {
                        gins(a, f, t);
                        return;
                }
index 870a90167af55e027e2aa88946ba06d52766dfb2..6cd0384126da046e7d727aca2c508de383f1443b 100644 (file)
@@ -1620,7 +1620,7 @@ signame(Type *t)
        // so that it can be referred to by the runtime.
        if(strcmp(buf, "interface { }") == 0)
                strcpy(buf, "empty");
-       
+
        // special case: sigi.... is just too hard to read in assembly.
        if(strcmp(buf, "...") == 0)
                strcpy(buf, "dotdotdot");
@@ -1707,7 +1707,7 @@ eqtype(Type *t1, Type *t2, int d)
                                        return 0;
                                if(ta->etype != TFIELD || tb->etype != TFIELD)
                                        return 0;
-                               if(!eqtype(ta->type, tb->type, 0))
+                               if(!eqtype(ta->type, tb->type, d+1))
                                        return 0;
                                ta = ta->down;
                                tb = tb->down;