[qfcc] Add a failing test for bogus uninitialized

The variable is very definitely initialized... by a memset (which is the
problem, actually).
This commit is contained in:
Bill Currie 2023-09-11 00:34:15 +09:00
parent 4bcbfc3473
commit b648c353ff
2 changed files with 18 additions and 0 deletions

View file

@ -82,6 +82,7 @@ test_progs_dat=\
fail_progs_dat=
test_build_passes=\
tools/qfcc/test/motor.r \
tools/qfcc/test/typeredef1.r \
tools/qfcc/test/typeredef2.r
@ -360,6 +361,9 @@ tools/qfcc/test/double-int-compare.run$(EXEEXT): tools/qfcc/test/double-int-comp
tools/qfcc/test/double-float-compare.run$(EXEEXT): tools/qfcc/test/double-float-compare.r $(qfcc_fail_run_deps)
@$(top_srcdir)/tools/qfcc/test/build-compile-fail-run $@ $(QFCC) $(QCFLAGS) $<
tools/qfcc/test/motor.run$(EXEEXT): tools/qfcc/test/motor.r $(qfcc_comp_run_deps)
@$(top_srcdir)/tools/qfcc/test/build-compile-pass-run $@ $(QFCC) $(QCFLAGS) -c $<
tools/qfcc/test/typeredef1.run$(EXEEXT): tools/qfcc/test/typeredef1.r $(qfcc_comp_run_deps)
@$(top_srcdir)/tools/qfcc/test/build-compile-pass-run $@ $(QFCC) $(QCFLAGS) -c $<

14
tools/qfcc/test/motor.r Normal file
View file

@ -0,0 +1,14 @@
typedef @algebra(float(3,0,1)) PGA;
typedef PGA.group_mask(0xa) bivector_t;
typedef PGA.group_mask(0x1e) motor_t;
motor_t
make_motor (vec4 translation, vec4 rotation)
{
auto dt = (PGA.group_mask(0x18)) translation;
auto q = (PGA.group_mask(0x06)) rotation;
motor_t t = { .scalar = 1, .bvecp = -dt.bvecp };
motor_t r = { .scalar = q.scalar, .bvect = q.bvect };
motor_t m = t * r;
return m;
}