diff options
| author | James Lyon <jamesly0n@hotmail.com> | 2013-04-27 20:39:34 +0100 |
|---|---|---|
| committer | James Lyon <jamesly0n@hotmail.com> | 2013-04-27 22:58:52 +0100 |
| commit | 41b3c7a50727f715111d09af982e2e9a0deeb688 (patch) | |
| tree | 0192d5295fd3cfca625ba769be2188ef72b15d64 /tests/Makefile | |
| parent | 6ee366e765483f6b48537d97fc81ae56f13d1b7f (diff) | |
| download | tinycc-41b3c7a50727f715111d09af982e2e9a0deeb688.tar.gz tinycc-41b3c7a50727f715111d09af982e2e9a0deeb688.tar.bz2 | |
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.
Diffstat (limited to 'tests/Makefile')
| -rw-r--r-- | tests/Makefile | 11 |
1 files changed, 11 insertions, 0 deletions
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 $@ $< |
