summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-01-28 16:42:26 -0800
committerRuss Cox <rsc@golang.org>2009-01-28 16:42:26 -0800
commit5b39196bb115a321fddce05ea000be426e7cb1e1 (patch)
tree29741695e8ee4949d7c268079d22a5e13b133a2e /src
parent1cfa78115e44a71b53e620958bfb6258f7ca95e2 (diff)
downloadgolang-5b39196bb115a321fddce05ea000be426e7cb1e1.tar.gz
fix possible infinite recursion in eqtype.
don't use intermediate register to move 32-or-fewer-bit immediate constants into memory. R=ken OCL=23726 CL=23726
Diffstat (limited to 'src')
-rw-r--r--src/cmd/6g/gsubr.c4
-rw-r--r--src/cmd/gc/subr.c4
2 files changed, 5 insertions, 3 deletions
diff --git a/src/cmd/6g/gsubr.c b/src/cmd/6g/gsubr.c
index 6934c6f30..86ba52c3f 100644
--- a/src/cmd/6g/gsubr.c
+++ b/src/cmd/6g/gsubr.c
@@ -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;
}
diff --git a/src/cmd/gc/subr.c b/src/cmd/gc/subr.c
index 870a90167..6cd038412 100644
--- a/src/cmd/gc/subr.c
+++ b/src/cmd/gc/subr.c
@@ -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;