Commit f500253d by Richard Kenner

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

From-SVN: r11771
parent 4ea62d1a
...@@ -5894,8 +5894,16 @@ finish_enum (enumtype, values, attributes) ...@@ -5894,8 +5894,16 @@ finish_enum (enumtype, values, attributes)
if (flag_short_enums || TYPE_PACKED (enumtype) if (flag_short_enums || TYPE_PACKED (enumtype)
|| precision > TYPE_PRECISION (integer_type_node)) || 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 else
TYPE_PRECISION (enumtype) = TYPE_PRECISION (integer_type_node); TYPE_PRECISION (enumtype) = TYPE_PRECISION (integer_type_node);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment