Add a test for accessing an array in a struct

That's accessed via a pointer. Whee. However, at this stage, the problem
is really a promotion issue for short -> integer.
This commit is contained in:
Bill Currie 2019-06-09 21:44:58 +09:00
parent e46a44d9c6
commit f70801fa52
2 changed files with 30 additions and 0 deletions

View file

@ -43,6 +43,7 @@ test_progs_dat=\
return-ivar.dat \
sendv.dat \
state.dat \
structarray.dat \
structlive.dat \
structptr.dat \
swap.dat \
@ -198,6 +199,15 @@ state.run: Makefile build-run
include ./$(DEPDIR)/state.Qo # am--include-marker
r_depfiles_remade += ./$(DEPDIR)/state.Qo
structarray_dat_SOURCES=structarray.r
structarray_obj=$(structarray_dat_SOURCES:.r=.qfo)
structarray.dat$(EXEEXT): $(structarray_obj) $(QFCC_DEP)
$(QFCC) $(QCFLAGS) -o $@ $(structarray_obj)
structarray.run: Makefile build-run
$(srcdir)/build-run $@
include ./$(DEPDIR)/structarray.Qo # am--include-marker
r_depfiles_remade += ./$(DEPDIR)/structarray.Qo
structlive_dat_SOURCES=structlive.r
structlive_obj=$(structlive_dat_SOURCES:.r=.qfo)
structlive.dat$(EXEEXT): $(structlive_obj) $(QFCC_DEP)

View file

@ -0,0 +1,20 @@
void printf (string fmt, ...) = #0;
void *obj_malloc (int size) = #0;
typedef struct {
int val;
int cap;
int ofs[];
} valstruct_t;
valstruct_t *vs;
int dst;
int
main ()
{
for (int i = 0; i < 2; i++) {
dst = vs.ofs[i];
}
return 1;
}