summaryrefslogtreecommitdiff
path: root/src/cmd/8g/cgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/8g/cgen.c')
-rw-r--r--src/cmd/8g/cgen.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cmd/8g/cgen.c b/src/cmd/8g/cgen.c
index 9c326e8ef..596824a6c 100644
--- a/src/cmd/8g/cgen.c
+++ b/src/cmd/8g/cgen.c
@@ -78,6 +78,8 @@ cgen(Node *n, Node *res)
// structs etc get handled specially
if(isfat(n->type)) {
+ if(n->type->width < 0)
+ fatal("forgot to compute width for %T", n->type);
sgen(n, res, n->type->width);
return;
}
@@ -898,7 +900,7 @@ bgen(Node *n, int true, Prog *to)
}
// make simplest on right
- if(nl->op == OLITERAL || nl->ullman < nr->ullman) {
+ if(nl->op == OLITERAL || (nl->ullman < nr->ullman && nl->ullman < UINF)) {
a = brrev(a);
r = nl;
nl = nr;
@@ -1023,8 +1025,8 @@ bgen(Node *n, int true, Prog *to)
if(nr->ullman >= UINF) {
tempname(&n1, nl->type);
tempname(&tmp, nr->type);
- cgen(nr, &tmp);
cgen(nl, &n1);
+ cgen(nr, &tmp);
regalloc(&n2, nr->type, N);
cgen(&tmp, &n2);
goto cmp;