[qfcc] Add failing test for return of postop

Commit 76b3bedb72 broke more than just the
swap test, but at least I know I need to get an edge in the dag.
Currently, the following code is generated: return and add are reversed.

    ../tools/qfcc/test/return-postop.r:8:   return counter++;
    0001 store.i counter, .tmp0
    0002 return .tmp0
    0003 add.i .tmp0, (1), counter

However, I don't want to deal with it right now, so it's marked XFAIL.
This commit is contained in:
Bill Currie 2022-01-21 12:05:50 +09:00
parent 7bc1396358
commit 64da1b603a
2 changed files with 35 additions and 1 deletions

View file

@ -41,6 +41,7 @@ test_progs_dat=\
tools/qfcc/test/ptrstructcast.dat \
tools/qfcc/test/quaternion.dat \
tools/qfcc/test/return-ivar.dat \
tools/qfcc/test/return-postop.dat \
tools/qfcc/test/sendv.dat \
tools/qfcc/test/state.dat \
tools/qfcc/test/static-init.dat \
@ -62,7 +63,8 @@ test_progs_dat=\
tools/qfcc/test/while.dat \
tools/qfcc/test/zerolinker.dat
fail_progs_dat=
fail_progs_dat=\
tools/qfcc/test/return-postop.dat
test_build_errors=\
tools/qfcc/test/classarray.r \
@ -483,6 +485,16 @@ tools/qfcc/test/return-ivar.run: $(qfcc_test_run_deps)
include $(return_ivar_dep) # am--include-marker
r_depfiles_remade += $(return_ivar_dep)
tools_qfcc_test_return_postop_dat_SOURCES=tools/qfcc/test/return-postop.r
return_postop_obj=$(tools_qfcc_test_return_postop_dat_SOURCES:.r=.o)
return_postop_dep=$(call qcautodep,$(tools_qfcc_test_return_postop_dat_SOURCES))
tools/qfcc/test/return-postop.dat$(EXEEXT): $(return_postop_obj) $(QFCC_DEP)
$(V_QFCCLD)$(QLINK) -o $@ $(return_postop_obj)
tools/qfcc/test/return-postop.run: $(qfcc_test_run_deps)
@$(top_srcdir)/tools/qfcc/test/build-run $@
include $(return_postop_dep) # am--include-marker
r_depfiles_remade += $(return_postop_dep)
tools_qfcc_test_sendv_dat_SOURCES=tools/qfcc/test/sendv.r
sendv_obj=$(tools_qfcc_test_sendv_dat_SOURCES:.r=.o)
sendv_dep=$(call qcautodep,$(tools_qfcc_test_sendv_dat_SOURCES))

View file

@ -0,0 +1,22 @@
#include "test-harness.h"
int counter;
int
function (void)
{
return counter++;
}
int
main (void)
{
int ret = 0;
counter = 0;
function ();
if (counter != 1) {
printf ("counter != 1: %d\n", counter);
ret = 1;
}
return ret;
}