summaryrefslogtreecommitdiff
path: root/6
diff options
context:
space:
mode:
authorS. Gilles <sgilles@math.umd.edu>2018-04-18 08:30:41 -0400
committerS. Gilles <sgilles@math.umd.edu>2018-04-18 08:30:41 -0400
commit9aabbe574e648e0a462b211c62da5eb5875343b7 (patch)
tree9ac90949a12806359fd4b996029757c84ef6e2a6 /6
parent4acd9ee51a541f94e81457b1a7fb3accbd790696 (diff)
parent3d71446ecb6569add0d9eaf2e7e4a05d99bd2625 (diff)
downloadmc-9aabbe574e648e0a462b211c62da5eb5875343b7.tar.gz
Merge remote-tracking branch 'ori/master' into HEAD
Diffstat (limited to '6')
-rw-r--r--6/main.c6
-rw-r--r--6/simp.c9
2 files changed, 14 insertions, 1 deletions
diff --git a/6/main.c b/6/main.c
index a153b8b..b770222 100644
--- a/6/main.c
+++ b/6/main.c
@@ -41,6 +41,7 @@ usage(char *prog)
printf("\t-o\tOutput to outfile\n");
printf("\t-O dir\tOutput to dir\n");
printf("\t-S\tGenerate assembly source alongside object code\n");
+ printf("\t-T\tCompile in test mode\n");
printf("\t-c\tEnable additional (possibly flaky) checking\n");
printf("\t-I path\tAdd 'path' to use search path\n");
printf("\t-d\tPrint debug dumps. Recognized options: f r p i\n");
@@ -200,7 +201,7 @@ main(int argc, char **argv)
outfile = NULL;
- optinit(&ctx, "cd:?hSo:I:9G:O:", argv, argc);
+ optinit(&ctx, "cd:?hSo:I:9G:O:T", argv, argc);
asmsyntax = Defaultasm;
sizefn = size;
while (!optdone(&ctx)) {
@@ -240,6 +241,9 @@ main(int argc, char **argv)
case 'I':
lappend(&incpaths, &nincpaths, ctx.optarg);
break;
+ case 'T':
+ allowhidden++;
+ break;
default:
usage(argv[0]);
exit(0);
diff --git a/6/simp.c b/6/simp.c
index d2a9d18..803c5d3 100644
--- a/6/simp.c
+++ b/6/simp.c
@@ -1006,6 +1006,15 @@ capture(Simp *s, Node *n, Node *dst)
envsz->expr.type = tyintptr;
assignat(s, e, 0, envsz);
assignat(s, fp, 0, e);
+ } else {
+ /*
+ * We need to zero out the environment, so that
+ * duplicating the function doesn't think we have
+ * a bogus environment.
+ */
+ e = mkintlit(n->loc, 0);
+ e->expr.type = tyintptr;
+ assignat(s, fp, 0, e);
}
assignat(s, fp, Ptrsz, f);
return dst;