]> Cypherpunks repositories - gostls13.git/commitdiff
shift bugs
authorKen Thompson <ken@golang.org>
Thu, 30 Oct 2008 03:25:34 +0000 (20:25 -0700)
committerKen Thompson <ken@golang.org>
Thu, 30 Oct 2008 03:25:34 +0000 (20:25 -0700)
R=r
OCL=18095
CL=18095

src/cmd/gc/const.c
src/cmd/gc/mparith2.c
src/cmd/gc/walk.c

index aff4a09a30d5367e88bccd190e3ef0f1a57efdb9..7ad2110af48f08a61c58fc0a58dcc84de6cc3f9d 100644 (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) {
index 591501140e26ae6b3104e0343a1984c75a8f31e1..c9116e701d150cebdb638b02d94ab3adb830f7a1 100644 (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);
 }
 
index ef80c5240fc7c8b1fbdda0cbbdb46178ec5d6b10..06f076d25076043dc2c7a3a13cea7f4ee84d97b9 100644 (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])