1
0
mirror of https://github.com/golang/go synced 2024-10-01 01:08:33 -06:00

minor bugs

R=r
OCL=14702
CL=14702
This commit is contained in:
Ken Thompson 2008-09-01 14:37:32 -07:00
parent 33ee52727f
commit a7f1af81bd
5 changed files with 13 additions and 12 deletions

View File

@ -102,10 +102,10 @@ dowidth(Type *t)
{
uint32 w;
w = 0;
if(t == T)
return;
w = 0;
switch(t->etype) {
default:
fatal("dowidth: unknown type: %E", t->etype);
@ -123,13 +123,13 @@ dowidth(Type *t)
case TINT32:
case TUINT32:
case TFLOAT32:
case TPTR32:
case TPTR32: // note lack of recursion
w = 4;
break;
case TINT64:
case TUINT64:
case TFLOAT64:
case TPTR64:
case TPTR64: // note lack of recursion
w = 8;
break;
case TFLOAT80:
@ -158,12 +158,9 @@ dowidth(Type *t)
w = wptr;
break;
case TARRAY:
if(t->bound < 0)
fatal("width of a dynamic array");
if(t->type == T)
break;
dowidth(t->type);
w = t->bound * t->type->width;
if(t->bound >= 0 && t->type != T)
w = t->bound * t->type->width;
break;
case TSTRUCT:

View File

@ -943,6 +943,7 @@ Atype:
| Afntypeh
| '*' Atype
{
dowidth($2);
$$ = ptrto($2);
}
@ -966,6 +967,7 @@ Btype:
| Bfntypeh
| '*' Btype
{
dowidth($2);
$$ = ptrto($2);
}
| '*' lname

View File

@ -29,7 +29,7 @@ pow(arg1,arg2 float64) float64
temp = floor(arg2);
if temp != arg2 {
panic sys.NaN();
panic(sys.NaN());
}
l = long(temp);

View File

@ -49,9 +49,11 @@ sqrt(arg float64) float64
exp = exp + 60;
}
if exp >= 0 {
temp = temp * float64(1 << (exp/2));
exp = 1 << uint(exp/2);
temp = temp * float64(exp);
} else {
temp = temp / float64(1 << (-exp/2));
exp = 1 << uint(-exp/2);
temp = temp / float64(exp);
}
for i=0; i<=4; i=i+1 {

View File

@ -60,7 +60,7 @@ tan(arg float64) float64
if flag {
if(temp == 0) {
panic sys.NaN();
panic(sys.NaN());
}
temp = 1/temp;
}