diff options
| author | gingerBill <bill@gingerbill.org> | 2022-05-25 17:26:18 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-05-25 17:26:18 +0100 |
| commit | b032d5af87ebe8d9dee28698cfa570d3628e58e5 (patch) | |
| tree | 6d2f1a90d597a3909430c8a4c6002b1e586e76e7 /src/check_type.cpp | |
| parent | d8e77cd738844b172d1741b1b1d3d4376efd17b5 (diff) | |
Make `#simd` an opaque type
Diffstat (limited to 'src/check_type.cpp')
| -rw-r--r-- | src/check_type.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp index 51f472961..193c42cde 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -2802,6 +2802,11 @@ bool check_type_internal(CheckerContext *ctx, Ast *e, Type **type, Type *named_t *type = alloc_type_array(elem, count, generic_type); goto array_end; } + if (count < 1 || !is_power_of_two(count)) { + error(at->elem, "Invalid length for 'intrinsics.simd_vector', expected a power of two length, got '%lld'", cast(long long)count); + *type = alloc_type_array(elem, count, generic_type); + goto array_end; + } *type = alloc_type_simd_vector(count, elem); } else { |