Add a test for the dead boolean expression.

This tests the zombie label problem found via ctf.
This commit is contained in:
Bill Currie 2012-11-26 21:05:24 +09:00
parent d6b38dd0ee
commit 215ff61216
2 changed files with 27 additions and 1 deletions

View file

@ -18,7 +18,7 @@ QFCC_TEST_LIBS=@QFCC_TEST_LIBS@
QFCC_TEST_DEPS=@QFCC_TEST_DEPS@
QFCC_TEST_INCS=@QFCC_TEST_INCS@
test_progs_dat=infloop.dat modulo.dat structptr.dat while.dat
test_progs_dat=deadbool.dat infloop.dat modulo.dat structptr.dat while.dat
TESTS=$(test_progs_dat:.dat=.run)
@ -28,6 +28,13 @@ test_harness_SOURCES= test-bi.c test-harness.c
test_harness_LDADD= $(QFCC_TEST_LIBS)
test_harness_DEPENDENCIES= $(QFCC_TEST_DEPS)
deadbool_dat_SOURCES=deadbool.r
deadbool_obj=$(deadbool_dat_SOURCES:.r=.qfo)
deadbool.dat: $(deadbool_obj) $(QFCC_DEP)
$(QFCC) $(QCFLAGS) -o $@ $(deadbool_obj)
deadbool.run: Makefile build-run
$(srcdir)/build-run $@
infloop_dat_SOURCES=infloop.r
infloop_obj=$(infloop_dat_SOURCES:.r=.qfo)
infloop.dat: $(infloop_obj) $(QFCC_DEP)

View file

@ -0,0 +1,19 @@
entity spawn (void) { return nil; }
.float f;
float time;
void foo (void)
{
local entity ent;
return;
if (!time) {
ent = spawn ();
ent.f = time + 0.1;
}
}
int main ()
{
return 0; // if the test compiles, it passes.
}