Be paranoid about temp var sizes

Prevents array index errors.
This commit is contained in:
Bill Currie 2019-06-10 00:19:48 +09:00
parent 28a2b96800
commit bf0543f7fb

View file

@ -199,6 +199,9 @@ temp_def (etype_t type, int size)
def_t *temp;
defspace_t *space = current_func->symtab->space;
if (size < 1 || size > 4) {
internal_error (0, "%d invalid size for temp def", size);
}
if ((temp = current_func->temp_defs[size - 1])) {
current_func->temp_defs[size - 1] = temp->temp_next;
temp->temp_next = 0;