From 41b3c7a50727f715111d09af982e2e9a0deeb688 Mon Sep 17 00:00:00 2001 From: James Lyon Date: Sat, 27 Apr 2013 20:39:34 +0100 Subject: Improved variable length array support. VLA storage is now freed when it goes out of scope. This makes it possible to use a VLA inside a loop without consuming an unlimited amount of memory. Combining VLAs with alloca() should work as in GCC - when a VLA is freed, memory allocated by alloca() after the VLA was created is also freed. There are some exceptions to this rule when using goto: if a VLA is in scope at the goto, jumping to a label will reset the stack pointer to where it was immediately after the last VLA was created prior to the label, or to what it was before the first VLA was created if the label is outside the scope of any VLA. This means that in some cases combining alloca() and VLAs will free alloca() memory where GCC would not. --- tests/Makefile | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/Makefile') diff --git a/tests/Makefile b/tests/Makefile index edb581c..08dfa42 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -14,6 +14,7 @@ TESTS = \ libtest \ test3 \ abitest \ + vla_test-run \ moretests # test4 -- problem with -static @@ -31,6 +32,10 @@ endif ifeq ($(TARGETOS),Darwin) TESTS := $(filter-out hello-exe test3 btest,$(TESTS)) endif +ifeq ($(ARCH),i386) +else ifneq ($(ARCH),x86-64) + TESTS := $(filter-out vla_test-run,$(TESTS)) +endif ifdef DISABLE_STATIC export LD_LIBRARY_PATH:=$(CURDIR)/.. @@ -190,6 +195,12 @@ abitest: abitest-cc$(EXESUF) abitest-tcc$(EXESUF) ./abitest-cc$(EXESUF) lib_path=.. include="$(top_srcdir)/include" ./abitest-tcc$(EXESUF) lib_path=.. include="$(top_srcdir)/include" +vla_test$(EXESUF): vla_test.c + $(TCC) -o $@ $^ $(CPPFLAGS) $(CFLAGS) +vla_test-run: vla_test$(EXESUF) + @echo ------------ $@ ------------ + ./vla_test$(EXESUF) + # targets for development %.bin: %.c tcc $(TCC) -g -o $@ $< -- cgit v1.3.1