diff --git a/tools/qfcc/include/type.h b/tools/qfcc/include/type.h index 5b3b3d7d4..2f3961fc0 100644 --- a/tools/qfcc/include/type.h +++ b/tools/qfcc/include/type.h @@ -219,6 +219,7 @@ const char *type_get_encoding (const type_t *type); #include "QF/progs/pr_type_names.h" int is_enum (const type_t *type) __attribute__((pure)); +int is_bool (const type_t *type) __attribute__((pure)); int is_integral (const type_t *type) __attribute__((pure)); int is_real (const type_t *type) __attribute__((pure)); int is_scalar (const type_t *type) __attribute__((pure)); diff --git a/tools/qfcc/source/type.c b/tools/qfcc/source/type.c index 8189c52cc..1adb8c3db 100644 --- a/tools/qfcc/source/type.c +++ b/tools/qfcc/source/type.c @@ -663,6 +663,9 @@ pointer_type (const type_t *aux) const type_t * matrix_type (const type_t *ele_type, int cols, int rows) { + if (!is_bool (ele_type) && !is_scalar (ele_type)) { + return nullptr; + } if (rows == 1 && cols == 1) { for (type_t **t = ev_types; t - ev_types < ev_type_count; t++) { if ((*t)->type == ele_type->type && (*t)->width == 1) { @@ -1251,6 +1254,17 @@ is_enum (const type_t *type) return 0; } +int +is_bool (const type_t *type) +{ + type = unalias_type (type); + if (type->meta != ty_bool) { + return 0; + } + //FIXME 64-bit bool + return type->type == ev_int; +} + int is_integral (const type_t *type) {