Do some sanity checking on storage class and defspace type.

Params and locals in virtual spaces, static vars in backed. Otherwise,
whatever (for now). Now func-static.r aborts :)
This commit is contained in:
Bill Currie 2012-12-04 14:18:17 +09:00
parent 0585471723
commit 6074a6648f
1 changed files with 5 additions and 0 deletions

View File

@ -122,6 +122,11 @@ new_def (const char *name, type_t *type, defspace_t *space,
set_storage_bits (def, storage);
if (space) {
if (space->type == ds_virtual && storage == sc_static)
internal_error (0, "static in a virtual space");
if (space->type != ds_virtual
&& (storage == sc_param || storage == sc_local))
internal_error (0, "param or local in a non-virtual space");
def->space = space;
*space->def_tail = def;
space->def_tail = &def->next;