Commit 9a442211 authored by Russ Cox's avatar Russ Cox

6l: more invalid input files

Fixes #963.
Fixes #964.

R=r
CC=golang-dev
https://golang.org/cl/1874045
parent bbf925aa
...@@ -427,21 +427,15 @@ zaddr(char *pn, Biobuf *f, Adr *a, Sym *h[]) ...@@ -427,21 +427,15 @@ zaddr(char *pn, Biobuf *f, Adr *a, Sym *h[])
} }
if(t & T_TYPE) if(t & T_TYPE)
a->type = Bgetc(f); a->type = Bgetc(f);
if(a->type < 0 || a->type >= D_SIZE)
mangle(pn);
adrgotype = S; adrgotype = S;
if(t & T_GOTYPE) if(t & T_GOTYPE)
adrgotype = zsym(pn, f, h); adrgotype = zsym(pn, f, h);
s = a->sym; s = a->sym;
if(s == S) {
switch(a->type) {
case D_SIZE:
mangle(pn);
}
return;
}
t = a->type; t = a->type;
if(t != D_AUTO && t != D_PARAM) { if(t != D_AUTO && t != D_PARAM) {
if(adrgotype) if(s && adrgotype)
s->gotype = adrgotype; s->gotype = adrgotype;
return; return;
} }
...@@ -581,6 +575,15 @@ loop: ...@@ -581,6 +575,15 @@ loop:
zaddr(pn, f, &p->from, h); zaddr(pn, f, &p->from, h);
fromgotype = adrgotype; fromgotype = adrgotype;
zaddr(pn, f, &p->to, h); zaddr(pn, f, &p->to, h);
switch(p->as) {
case ATEXT:
case ADATA:
case AGLOBL:
if(p->from.sym == S)
mangle(pn);
break;
}
if(debug['W']) if(debug['W'])
print("%P\n", p); print("%P\n", p);
......
...@@ -904,6 +904,6 @@ iconv(Fmt *fp) ...@@ -904,6 +904,6 @@ iconv(Fmt *fp)
void void
mangle(char *file) mangle(char *file)
{ {
fprint(2, "%s; mangled input file\n", file); fprint(2, "%s: mangled input file\n", file);
errorexit(); errorexit();
} }
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