This patch corrects the expansion of attribute 'Width when applied to a dynamic enumeration type with suppressed names.
Tested on x86_64-pc-linux-gnu, committed on trunk 2011-12-20 Hristian Kirtchev <kirtc...@adacore.com> * exp_imgv.adb (Expand_Width_Attribute): Add a type conversion from the enumeration subtype to its base subtype.
Index: exp_imgv.adb =================================================================== --- exp_imgv.adb (revision 182532) +++ exp_imgv.adb (working copy) @@ -1177,7 +1177,7 @@ -- ... -- else n)))... - -- where n is equal to Rtyp'Pos (Rtyp'Last) + 1 + -- where n is equal to Rtyp'Pos (Ptyp'Last) + 1 -- Note: The above processing is in accordance with the intent of -- the RM, which is that Width should be related to the impl-defined @@ -1206,12 +1206,13 @@ New_Occurrence_Of (Standard_Integer, Loc), Expression => Make_Attribute_Reference (Loc, - Prefix => New_Occurrence_Of (Rtyp, Loc), - Attribute_Name => Name_Pos, - Expressions => New_List ( - Make_Attribute_Reference (Loc, - Prefix => New_Occurrence_Of (Ptyp, Loc), - Attribute_Name => Name_Last))))); + Prefix => New_Occurrence_Of (Rtyp, Loc), + Attribute_Name => Name_Pos, + Expressions => New_List ( + Convert_To (Rtyp, + Make_Attribute_Reference (Loc, + Prefix => New_Occurrence_Of (Ptyp, Loc), + Attribute_Name => Name_Last)))))); -- OK, now we need to build the conditional expression. First -- get the value of M, the largest possible value needed.