(finish_enum): Don't crash if no type can represent all enumeration values.

From-SVN: r11771
This commit is contained in:
Richard Kenner 1996-04-14 19:01:38 -04:00
parent 4ea62d1a1e
commit f500253d32
1 changed files with 10 additions and 2 deletions

View File

@ -5894,8 +5894,16 @@ finish_enum (enumtype, values, attributes)
if (flag_short_enums || TYPE_PACKED (enumtype)
|| precision > TYPE_PRECISION (integer_type_node))
/* Use the width of the narrowest normal C type which is wide enough. */
TYPE_PRECISION (enumtype) = TYPE_PRECISION (type_for_size (precision, 1));
{
tree narrowest = type_for_size (precision, 1);
if (narrowest == 0)
{
warning ("enumeration values exceed range of largest integer");
narrowest = long_long_integer_type_node;
}
TYPE_PRECISION (enumtype) = TYPE_PRECISION (narrowest);
}
else
TYPE_PRECISION (enumtype) = TYPE_PRECISION (integer_type_node);