Commit b1abcc19 authored by Ken Thompson's avatar Ken Thompson

random bug fixes

R=r
DELTA=18  (6 added, 1 deleted, 11 changed)
OCL=13504
CL=13504
parent bd397d2f
...@@ -382,7 +382,6 @@ agen_inter(Node *n, Node *res) ...@@ -382,7 +382,6 @@ agen_inter(Node *n, Node *res)
if(!n->left->addable) { if(!n->left->addable) {
agen(n->left, &nodr); agen(n->left, &nodr);
gmove(&nodr, &nodo); gmove(&nodr, &nodo);
dump("xxx", n->left);
fatal("agen_inter i2s"); fatal("agen_inter i2s");
} else { } else {
cgen(n->left, &nodo); cgen(n->left, &nodo);
......
...@@ -191,6 +191,9 @@ evconst(Node *n) ...@@ -191,6 +191,9 @@ evconst(Node *n)
case TUP(OAND, Wlitint): case TUP(OAND, Wlitint):
nl->val.vval &= nr->val.vval; nl->val.vval &= nr->val.vval;
break; break;
case TUP(OXOR, Wlitint):
nl->val.vval ^= nr->val.vval;
break;
case TUP(OADD, Wlitfloat): case TUP(OADD, Wlitfloat):
nl->val.dval += nr->val.dval; nl->val.dval += nr->val.dval;
......
...@@ -49,7 +49,7 @@ reexport(Type *t) ...@@ -49,7 +49,7 @@ reexport(Type *t)
Sym *s; Sym *s;
if(t == T) if(t == T)
fatal("reexport: type nil\n"); fatal("reexport: type nil");
s = t->sym; s = t->sym;
if(s == S/* || s->name[0] == '_'*/) { if(s == S/* || s->name[0] == '_'*/) {
...@@ -75,7 +75,7 @@ dumpexportconst(Sym *s) ...@@ -75,7 +75,7 @@ dumpexportconst(Sym *s)
n = s->oconst; n = s->oconst;
if(n == N || n->op != OLITERAL) if(n == N || n->op != OLITERAL)
fatal("dumpexportconst: oconst nil: %S\n", s); fatal("dumpexportconst: oconst nil: %S", s);
t = n->type; // may or may not be specified t = n->type; // may or may not be specified
if(t != T) if(t != T)
...@@ -90,7 +90,7 @@ dumpexportconst(Sym *s) ...@@ -90,7 +90,7 @@ dumpexportconst(Sym *s)
switch(n->val.ctype) { switch(n->val.ctype) {
default: default:
fatal("dumpexportconst: unknown ctype: %S\n", s); fatal("dumpexportconst: unknown ctype: %S", s);
case CTINT: case CTINT:
case CTSINT: case CTSINT:
case CTUINT: case CTUINT:
...@@ -149,13 +149,13 @@ dumpexporttype(Sym *s) ...@@ -149,13 +149,13 @@ dumpexporttype(Sym *s)
} }
if(t->sym != s) if(t->sym != s)
fatal("dumpexporttype: cross reference: %S\n", s); fatal("dumpexporttype: cross reference: %S", s);
et = t->etype; et = t->etype;
switch(et) { switch(et) {
default: default:
if(et < 0 || et >= nelem(types) || types[et] == T) if(et < 0 || et >= nelem(types) || types[et] == T)
fatal("dumpexporttype: basic type: %S %E\n", s, et); fatal("dumpexporttype: basic type: %S %E", s, et);
/* type 5 */ /* type 5 */
Bprint(bout, "\ttype %lS %d\n", s, et); Bprint(bout, "\ttype %lS %d\n", s, et);
break; break;
...@@ -184,7 +184,7 @@ dumpexporttype(Sym *s) ...@@ -184,7 +184,7 @@ dumpexporttype(Sym *s)
case TFUNC: case TFUNC:
for(f=t->type; f!=T; f=f->down) { for(f=t->type; f!=T; f=f->down) {
if(f->etype != TSTRUCT) if(f->etype != TSTRUCT)
fatal("dumpexporttype: funct not field: %T\n", f); fatal("dumpexporttype: funct not field: %T", f);
reexport(f); reexport(f);
} }
...@@ -205,7 +205,7 @@ dumpexporttype(Sym *s) ...@@ -205,7 +205,7 @@ dumpexporttype(Sym *s)
case TINTER: case TINTER:
for(f=t->type; f!=T; f=f->down) { for(f=t->type; f!=T; f=f->down) {
if(f->etype != TFIELD) if(f->etype != TFIELD)
fatal("dumpexporttype: funct not field: %lT\n", f); fatal("dumpexporttype: funct not field: %lT", f);
reexport(f->type); reexport(f->type);
} }
...@@ -316,7 +316,7 @@ getimportsym(Node *ss) ...@@ -316,7 +316,7 @@ getimportsym(Node *ss)
Sym *s; Sym *s;
if(ss->op != OIMPORT) if(ss->op != OIMPORT)
fatal("getimportsym: oops1 %N\n", ss); fatal("getimportsym: oops1 %N", ss);
pkg = ss->psym->name; pkg = ss->psym->name;
s = pkglookup(ss->sym->name, pkg); s = pkglookup(ss->sym->name, pkg);
...@@ -333,7 +333,7 @@ importlooktype(Node *n) ...@@ -333,7 +333,7 @@ importlooktype(Node *n)
s = getimportsym(n); s = getimportsym(n);
if(s->otype == T) if(s->otype == T)
fatal("importlooktype: oops2 %S\n", s); fatal("importlooktype: oops2 %S", s);
return s->otype; return s->otype;
} }
...@@ -392,7 +392,7 @@ importfuncnam(Type *t) ...@@ -392,7 +392,7 @@ importfuncnam(Type *t)
Type *t1; Type *t1;
if(t->etype != TFUNC) if(t->etype != TFUNC)
fatal("importfuncnam: not func %T\n", t); fatal("importfuncnam: not func %T", t);
if(t->thistuple > 0) { if(t->thistuple > 0) {
t1 = t->type; t1 = t->type;
...@@ -591,7 +591,7 @@ doimport5(Node *ss, Val *v) ...@@ -591,7 +591,7 @@ doimport5(Node *ss, Val *v)
et = v->vval; et = v->vval;
if(et <= 0 || et >= nelem(types) || types[et] == T) if(et <= 0 || et >= nelem(types) || types[et] == T)
fatal("doimport5: bad type index: %E\n", et); fatal("doimport5: bad type index: %E", et);
t = typ(et); t = typ(et);
t->sym = S; t->sym = S;
......
...@@ -762,7 +762,7 @@ pexpr: ...@@ -762,7 +762,7 @@ pexpr:
* from other packages * from other packages
*/ */
lpack: lpack:
LPACK LPACK
{ {
context = $1->name; context = $1->name;
} }
......
...@@ -93,6 +93,9 @@ mainlex(int argc, char *argv[]) ...@@ -93,6 +93,9 @@ mainlex(int argc, char *argv[])
dumpobj(); dumpobj();
if(nerrors)
errorexit();
myexit(0); myexit(0);
return 0; return 0;
......
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