@@ -1246,15 +1246,49 @@ package body Tree_Walk is
12461246 exit when not Present (Member);
12471247 end loop ;
12481248
1249- return Make_C_Enum_Type
1250- (I_Subtype =>
1251- Make_Bounded_Signedbv_Type
1252- (Width => 32 , -- FIXME why 32?
1253- Lower_Bound => Store_Symbol_Bound
1254- (Bound_Type_Symbol (Do_Defining_Identifier (First_Member))),
1255- Upper_Bound => Store_Symbol_Bound
1256- (Bound_Type_Symbol (Do_Defining_Identifier (Last_Member)))),
1257- I_Body => Enum_Body);
1249+ declare
1250+ function Make_Char_Symbol (N : Node_Id) return Irep is
1251+ (Make_Symbol_Expr
1252+ (Source_Location => Get_Source_Location (N),
1253+ I_Type => Enum_Type_Symbol,
1254+ Range_Check => False,
1255+ Identifier => Unique_Name (N)))
1256+ with Pre => Nkind (N) = N_Defining_Character_Literal;
1257+
1258+ Lower_Bound : constant Irep :=
1259+ (case Nkind (First_Member) is
1260+ when N_Defining_Identifier =>
1261+ Do_Defining_Identifier (First_Member),
1262+ when N_Defining_Character_Literal =>
1263+ Make_Char_Symbol (First_Member),
1264+ when others =>
1265+ Report_Unhandled_Node_Irep
1266+ (N => First_Member,
1267+ Fun_Name => " Do_Enumeration_Definition" ,
1268+ Message => " Incorrect Enumeration Literal" ));
1269+
1270+ Upper_Bound : constant Irep :=
1271+ (case Nkind (Last_Member) is
1272+ when N_Defining_Identifier =>
1273+ Do_Defining_Identifier (Last_Member),
1274+ when N_Defining_Character_Literal =>
1275+ Make_Char_Symbol (Last_Member),
1276+ when others =>
1277+ Report_Unhandled_Node_Irep
1278+ (N => Last_Member,
1279+ Fun_Name => " Do_Enumeration_Definition" ,
1280+ Message => " Incorrect Enumeration Literal" ));
1281+ begin
1282+ return Make_C_Enum_Type
1283+ (I_Subtype =>
1284+ Make_Bounded_Signedbv_Type
1285+ (Width => 32 , -- FIXME why 32?
1286+ Lower_Bound => Store_Symbol_Bound
1287+ (Bound_Type_Symbol (Lower_Bound)),
1288+ Upper_Bound => Store_Symbol_Bound
1289+ (Bound_Type_Symbol (Upper_Bound))),
1290+ I_Body => Enum_Body);
1291+ end ;
12581292 end Do_Enumeration_Definition ;
12591293
12601294 function Do_Attribute_Pos_Val (N : Node_Id) return Irep is
0 commit comments