[qfcc] Add a second failing array lifetime test

This one covers regular array references across function call.
This commit is contained in:
Bill Currie 2023-06-05 10:58:02 +09:00
parent 38fd09573f
commit a5ed154cfe
2 changed files with 41 additions and 0 deletions

View file

@ -11,6 +11,7 @@ test_progs_dat=\
tools/qfcc/test/address-cast.dat \
tools/qfcc/test/alignment.dat \
tools/qfcc/test/arraylife.dat \
tools/qfcc/test/arraylife2.dat \
tools/qfcc/test/assignchain.dat \
tools/qfcc/test/anonstruct.dat \
tools/qfcc/test/chewed-alias.dat \
@ -168,6 +169,16 @@ tools/qfcc/test/arraylife.run: $(qfcc_test_run_deps)
include $(arraylife_dep) # am--include-marker
r_depfiles_remade += $(arraylife_dep)
tools_qfcc_test_arraylife2_dat_SOURCES=tools/qfcc/test/arraylife2.r
arraylife2_obj=$(tools_qfcc_test_arraylife2_dat_SOURCES:.r=.o)
arraylife2_dep=$(call qcautodep,$(tools_qfcc_test_arraylife2_dat_SOURCES))
tools/qfcc/test/arraylife2.dat$(EXEEXT): $(arraylife2_obj) $(QFCC_DEP)
$(V_QFCCLD)$(QLINK) -o $@ $(arraylife2_obj)
tools/qfcc/test/arraylife2.run: $(qfcc_test_run_deps)
@$(top_srcdir)/tools/qfcc/test/build-run $@
include $(arraylife2_dep) # am--include-marker
r_depfiles_remade += $(arraylife2_dep)
tools_qfcc_test_assignchain_dat_SOURCES=tools/qfcc/test/assignchain.r
assignchain_obj=$(tools_qfcc_test_assignchain_dat_SOURCES:.r=.o)
assignchain_dep=$(call qcautodep,$(tools_qfcc_test_assignchain_dat_SOURCES))

View file

@ -0,0 +1,30 @@
vector bar (float *v);
vector snafu (float *v);
vector
foo (float x, float y, float z)
{
float v[3] = { x, y, z };
float w[3] = { x, y, z };
snafu (v);
return bar (w);
}
vector snafu (float *v)
{
return nil;
}
vector
bar (float *v)
{
return [v[0], v[1], v[2]];
}
int
main ()
{
int ret = 0;
ret |= foo(1,2,3) != [1, 2, 3];
return ret;
}