aboutsummaryrefslogtreecommitdiff
path: root/tests/tcctest.c
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2017-07-10 22:25:11 +0200
committerMichael Matz <matz@suse.de>2017-07-10 22:25:11 +0200
commit9bea88d61611dc12eeb211e342461f9157177464 (patch)
treed8a3c666fce163dd132c7bf01e6c13c1396676c4 /tests/tcctest.c
parent2240422da9b55b71cfb32220bb0246ec92bfc432 (diff)
downloadtinycc-9bea88d61611dc12eeb211e342461f9157177464.tar.gz
tinycc-9bea88d61611dc12eeb211e342461f9157177464.tar.bz2
Fix statement exprs returning a local label
Like returned local variables also labels local to a statement expression can be returned, and so their symbols must not be immediately freed (though they need to be removed from the symbol table).
Diffstat (limited to 'tests/tcctest.c')
-rw-r--r--tests/tcctest.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/tcctest.c b/tests/tcctest.c
index 10203ec..f657c14 100644
--- a/tests/tcctest.c
+++ b/tests/tcctest.c
@@ -2899,6 +2899,11 @@ struct hlist_head {
struct hlist_node *first, *last;
};
+void consume_ulong (unsigned long i)
+{
+ i = 0;
+}
+
void statement_expr_test(void)
{
int a, i;
@@ -2954,6 +2959,9 @@ void statement_expr_test(void)
});
printf ("stmtexpr: %d %d %d\n", t, b, c);
printf ("stmtexpr: %ld %ld\n", (long)h.first, (long)h.last);
+
+ /* Test that we can give out addresses of local labels. */
+ consume_ulong(({ __label__ __here; __here: (unsigned long)&&__here; }));
}
void local_label_test(void)