ref: fd1b8b6f31b7a8c2705c3ac01e46fd707c0d3c9e
parent: ebbdfc2631ac5876397ccc52453b69cfd223c95d
author: Ori Bernstein <[email protected]>
date: Mon Dec 4 18:50:46 EST 2017
Handle locally declared extern consts correctly. Ugh. Edge cases.
--- a/6/simp.c
+++ b/6/simp.c
@@ -181,7 +181,9 @@
static void
declarelocal(Simp *s, Node *n)
{
- if (stacknode(n))
+ if (isconstfn(n))
+ htput(s->globls, n, asmname(n));
+ else if (stacknode(n))
forcelocal(s, n);
}
--- a/mi/flatten.c
+++ b/mi/flatten.c
@@ -1081,7 +1081,9 @@
d = n;
}
t = tybase(decltype(d));
- if (!d || !d->decl.isconst || !d->decl.isglobl || d->decl.isgeneric)
+ if (!d || !d->decl.isconst || d->decl.isgeneric)
+ return 0;
+ if (!d->decl.isglobl && !d->decl.isextern)
return 0;
if (t->type != Tyfunc && t->type != Tycode)
return 0;