mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-11 20:03:11 +00:00
[qfcc] Clear spec.type_expr after resolving
Fixes an ICE when compiling simplex.r (thus its addition to qfcc's tests). It still fails due to having lost the points parameter, but yet another automated test :)
This commit is contained in:
parent
e179b10455
commit
2c96acc4f0
3 changed files with 29 additions and 0 deletions
|
@ -720,6 +720,7 @@ spec_process (specifier_t spec, rua_ctx_t *ctx)
|
|||
auto type = spec.type; // core type (int etc)
|
||||
if (spec.type_expr) {
|
||||
type = resolve_type (spec.type_expr, ctx);
|
||||
spec.type_expr = nullptr;
|
||||
}
|
||||
//const type_t *type = nullptr;
|
||||
// other than fields, the type list is built up by appending types
|
||||
|
|
|
@ -94,6 +94,7 @@ fail_progs_dat=
|
|||
test_build_passes=\
|
||||
tools/qfcc/test/calluse2.r \
|
||||
tools/qfcc/test/motor.r \
|
||||
tools/qfcc/test/simplex.r \
|
||||
tools/qfcc/test/typeredef1.r \
|
||||
tools/qfcc/test/typeredef2.r
|
||||
|
||||
|
@ -407,6 +408,9 @@ tools/qfcc/test/calluse2.run$(EXEEXT): tools/qfcc/test/calluse2.r $(qfcc_comp_ru
|
|||
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/simplex.run$(EXEEXT): tools/qfcc/test/simplex.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 $<
|
||||
|
||||
|
|
24
tools/qfcc/test/simplex.r
Normal file
24
tools/qfcc/test/simplex.r
Normal file
|
@ -0,0 +1,24 @@
|
|||
#pragma bug die
|
||||
typedef @algebra(float(3,0,0)) VGA;
|
||||
typedef struct { VGA.bvec m[3]; } tensor_t;
|
||||
|
||||
tensor_t
|
||||
inertia_tensor (VGA.vec *points)
|
||||
{
|
||||
@algebra(VGA) {
|
||||
static VGA.bvec basis[3] = {e23, e31, e12};
|
||||
tensor_t tensor = nil;
|
||||
for (int k = 0; k < 3; k++) {
|
||||
VGA.bvec ten = nil;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
ten += (points[i] • points[j] * basis[k]
|
||||
- points[i] * basis[k] * points[j]).bvec
|
||||
* ((i == j) ? 2 : 1);
|
||||
}
|
||||
}
|
||||
tensor.m[k] = ten;
|
||||
}
|
||||
return tensor;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue