1
0
mirror of https://github.com/golang/go synced 2024-11-26 17:16:54 -07:00

shift bugs

R=r
OCL=18095
CL=18095
This commit is contained in:
Ken Thompson 2008-10-29 20:25:34 -07:00
parent 9639bd0dd7
commit 2c050571d8
3 changed files with 9 additions and 5 deletions

View File

@ -12,6 +12,7 @@ convlit(Node *n, Type *t)
if(n == N || t == T)
return;
switch(n->op) {
default:
return;
@ -25,7 +26,6 @@ convlit(Node *n, Type *t)
}
et = t->etype;
wt = whatis(n);
switch(wt) {

View File

@ -84,7 +84,7 @@ mprsh(Mpint *a)
if(x & 1)
c = Mpbase;
}
if(a->neg && lo == 0)
if(a->neg && lo != 0)
mpaddcfix(a, -1);
}
@ -105,7 +105,7 @@ mprshw(Mpint *a)
a1++;
}
a1[0] = 0;
if(a->neg && lo == 0)
if(a->neg && lo != 0)
mpaddcfix(a, -1);
}

View File

@ -170,6 +170,8 @@ walktype(Node *n, int top)
int et, cl, cr;
int32 lno;
if(n == N)
return;
lno = setlineno(n);
/*
@ -645,8 +647,10 @@ loop:
evconst(n);
if(n->op == OLITERAL)
goto ret;
convlit(n->right, types[TUINT]);
convlit(n->left, types[TINT]);
if(n->left->type == T)
convlit(n->left, types[TINT]);
if(n->right->type == T)
convlit(n->right, types[TUINT]);
if(n->left->type == T || n->right->type == T)
goto ret;
if(issigned[n->right->type->etype])