mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-19 15:30:50 +00:00
[qfcc] Add a second failing array lifetime test
This one covers regular array references across function call.
This commit is contained in:
parent
38fd09573f
commit
a5ed154cfe
2 changed files with 41 additions and 0 deletions
|
@ -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))
|
||||
|
|
30
tools/qfcc/test/arraylife2.r
Normal file
30
tools/qfcc/test/arraylife2.r
Normal 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;
|
||||
}
|
Loading…
Reference in a new issue