This crashes gcc's undefined behaviour sanitizer.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
/* Use each component from each entry in the value_list to initialize one
* component of the constant being constructed.
*/
- for (unsigned i = 0; i < type->components(); /* empty */) {
+ unsigned i = 0;
+ for (;;) {
assert(value->as_constant() != NULL);
assert(!value->is_tail_sentinel());
break;
}
+ if (i >= type->components())
+ break; /* avoid downcasting a list sentinel */
value = (ir_constant *) value->next;
}
}