From 3665a0566a557b7f3270d4d40f4cf4de8a6967a6 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 13 Dec 2012 13:44:25 +0900 Subject: [PATCH] Add a test for struct writes. This tests local kills via aliases. --- tools/qfcc/test/Makefile.am | 8 ++++++++ tools/qfcc/test/structlive.r | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 tools/qfcc/test/structlive.r diff --git a/tools/qfcc/test/Makefile.am b/tools/qfcc/test/Makefile.am index e12101ff9..01f53cc27 100644 --- a/tools/qfcc/test/Makefile.am +++ b/tools/qfcc/test/Makefile.am @@ -25,6 +25,7 @@ test_progs_dat=\ deadbool.dat \ infloop.dat \ modulo.dat \ + structlive.dat \ structptr.dat \ vecinit.dat \ while.dat @@ -83,6 +84,13 @@ modulo.dat: $(modulo_obj) $(QFCC_DEP) modulo.run: Makefile build-run TEST_HARNESS_OPTS=--float $(srcdir)/build-run $@ +structlive_dat_SOURCES=structlive.r +structlive_obj=$(structlive_dat_SOURCES:.r=.qfo) +structlive.dat: $(structlive_obj) $(QFCC_DEP) + $(QFCC) $(QCFLAGS) -o $@ $(structlive_obj) +structlive.run: Makefile build-run + $(srcdir)/build-run $@ + structptr_dat_SOURCES=structptr.r structptr_obj=$(structptr_dat_SOURCES:.r=.qfo) structptr.dat: $(structptr_obj) $(QFCC_DEP) diff --git a/tools/qfcc/test/structlive.r b/tools/qfcc/test/structlive.r new file mode 100644 index 000000000..dbb6c03d4 --- /dev/null +++ b/tools/qfcc/test/structlive.r @@ -0,0 +1,20 @@ +@param foo (int r) +{ + @param ret; + ret = nil; + ret.int_val = r; + return ret; +} + +int main () +{ + @param ret; + int i; + + for (i = 0; i < 5; i++) { + ret = foo (i); + if (ret.int_val != i) + return 1; + } + return 0; +}