[qfcc] Avoid ubsan related warning with lto

I'm not sure what's up (I doubt it's actually ub, it's just that it took
enabling ubsan *and* link-time-optimizations to see the warning), and
the warning is technically correct, though going from -1 (int) to
0xfffffff400000000 has me stumped, but ensuring width is 2-4 does take
care of it. All because I got a weird test failure that I wound up being
unable to reproduce after rebuilding qfcc (thus the ubsan pass, but no
other sniffles).
This commit is contained in:
Bill Currie 2024-09-20 13:30:28 +09:00
parent 186a781121
commit e09f97685f

View file

@ -1706,7 +1706,7 @@ build_vector_struct (type_t *type)
auto ele_type = base_type (type);
int width = type_width (type);
if (!ele_type || width < 2) {
if (!ele_type || width < 2 || width > 4) {
internal_error (0, "%s not a vector type: %p %d", type->name, ele_type, width);
}