mirror of
https://forge.sourceware.org/marek/gcc.git
synced 2026-02-22 03:47:02 -05:00
d: Fix ICE: type variant differs by TYPE_MAX_VALUE with -g [PR119826]
Forward referenced enum types were never fixed up after the main ENUMERAL_TYPE was finished. All flags set are now propagated to all variants after its mode, size, and alignment has been calculated. PR d/119826 gcc/d/ChangeLog: * types.cc (TypeVisitor::visit (TypeEnum *)): Propagate flags of main enum types to all forward-referenced variants. gcc/testsuite/ChangeLog: * gdc.dg/debug/imports/pr119826b.d: New test. * gdc.dg/debug/pr119826.d: New test.
This commit is contained in:
@@ -1179,6 +1179,26 @@ public:
|
||||
|
||||
layout_type (t->ctype);
|
||||
|
||||
/* Fix up all forward-referenced variants of this enum type. */
|
||||
for (tree v = TYPE_MAIN_VARIANT (t->ctype); v;
|
||||
v = TYPE_NEXT_VARIANT (v))
|
||||
{
|
||||
if (v == t->ctype)
|
||||
continue;
|
||||
|
||||
TYPE_VALUES (v) = TYPE_VALUES (t->ctype);
|
||||
TYPE_LANG_SPECIFIC (v) = TYPE_LANG_SPECIFIC (t->ctype);
|
||||
TYPE_MIN_VALUE (v) = TYPE_MIN_VALUE (t->ctype);
|
||||
TYPE_MAX_VALUE (v) = TYPE_MAX_VALUE (t->ctype);
|
||||
TYPE_UNSIGNED (v) = TYPE_UNSIGNED (t->ctype);
|
||||
TYPE_SIZE (v) = TYPE_SIZE (t->ctype);
|
||||
TYPE_SIZE_UNIT (v) = TYPE_SIZE_UNIT (t->ctype);
|
||||
SET_TYPE_MODE (v, TYPE_MODE (t->ctype));
|
||||
TYPE_PRECISION (v) = TYPE_PRECISION (t->ctype);
|
||||
SET_TYPE_ALIGN (v, TYPE_ALIGN (t->ctype));
|
||||
TYPE_USER_ALIGN (v) = TYPE_USER_ALIGN (t->ctype);
|
||||
}
|
||||
|
||||
/* Complete forward-referenced fields of this enum type. */
|
||||
finish_incomplete_fields (t->ctype);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user