Don't bother creating an alias for a def of the same type.

This commit is contained in:
Bill Currie 2012-12-05 19:43:27 +09:00
parent cc88202f8c
commit 2904c619c1

View file

@ -165,6 +165,8 @@ alias_def (def_t *def, type_t *type, int offset)
internal_error (0, "aliasing a def to a larger type"); internal_error (0, "aliasing a def to a larger type");
if (offset < 0 || offset + type_size (type) > type_size (def->type)) if (offset < 0 || offset + type_size (type) > type_size (def->type))
internal_error (0, "invalid alias offset"); internal_error (0, "invalid alias offset");
if (type == def->type)
return def;
for (alias = def->alias_defs; alias; alias = alias->next) { for (alias = def->alias_defs; alias; alias = alias->next) {
if (alias->type == type && alias->offset == offset) if (alias->type == type && alias->offset == offset)
return alias; return alias;