Commit 2c050571 authored by Ken Thompson's avatar Ken Thompson

shift bugs

R=r
OCL=18095
CL=18095
parent 9639bd0d
...@@ -12,6 +12,7 @@ convlit(Node *n, Type *t) ...@@ -12,6 +12,7 @@ convlit(Node *n, Type *t)
if(n == N || t == T) if(n == N || t == T)
return; return;
switch(n->op) { switch(n->op) {
default: default:
return; return;
...@@ -25,7 +26,6 @@ convlit(Node *n, Type *t) ...@@ -25,7 +26,6 @@ convlit(Node *n, Type *t)
} }
et = t->etype; et = t->etype;
wt = whatis(n); wt = whatis(n);
switch(wt) { switch(wt) {
......
...@@ -84,7 +84,7 @@ mprsh(Mpint *a) ...@@ -84,7 +84,7 @@ mprsh(Mpint *a)
if(x & 1) if(x & 1)
c = Mpbase; c = Mpbase;
} }
if(a->neg && lo == 0) if(a->neg && lo != 0)
mpaddcfix(a, -1); mpaddcfix(a, -1);
} }
...@@ -105,7 +105,7 @@ mprshw(Mpint *a) ...@@ -105,7 +105,7 @@ mprshw(Mpint *a)
a1++; a1++;
} }
a1[0] = 0; a1[0] = 0;
if(a->neg && lo == 0) if(a->neg && lo != 0)
mpaddcfix(a, -1); mpaddcfix(a, -1);
} }
......
...@@ -170,6 +170,8 @@ walktype(Node *n, int top) ...@@ -170,6 +170,8 @@ walktype(Node *n, int top)
int et, cl, cr; int et, cl, cr;
int32 lno; int32 lno;
if(n == N)
return;
lno = setlineno(n); lno = setlineno(n);
/* /*
...@@ -645,8 +647,10 @@ loop: ...@@ -645,8 +647,10 @@ loop:
evconst(n); evconst(n);
if(n->op == OLITERAL) if(n->op == OLITERAL)
goto ret; goto ret;
convlit(n->right, types[TUINT]); if(n->left->type == T)
convlit(n->left, types[TINT]); convlit(n->left, types[TINT]);
if(n->right->type == T)
convlit(n->right, types[TUINT]);
if(n->left->type == T || n->right->type == T) if(n->left->type == T || n->right->type == T)
goto ret; goto ret;
if(issigned[n->right->type->etype]) if(issigned[n->right->type->etype])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment