From 9bea88d61611dc12eeb211e342461f9157177464 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Mon, 10 Jul 2017 22:25:11 +0200 Subject: 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). --- tests/tcctest.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/tcctest.c') 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) -- cgit v1.3.1