[Ada] Fix evaluation of Enum_Rep applied to imported constant
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 7 May 2020 12:08:07 +0000 (14:08 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 6 Jul 2020 11:35:06 +0000 (07:35 -0400)
gcc/ada/

* sem_attr.adb (Eval_Attribute): Check if constant has an
initialization expression.

gcc/ada/sem_attr.adb

index 4f112065abeddbba96e94694296de8382e816b3f..5e61810fbf953b5d6a06d0234df78210bdbd68cb 100644 (file)
@@ -7834,6 +7834,8 @@ package body Sem_Attr is
                        (Ekind (Entity (Enum_Expr)) = E_Constant
                           and then Nkind (Parent (Entity (Enum_Expr))) =
                                      N_Object_Declaration
+                          and then Present
+                                     (Expression (Parent (Entity (P))))
                           and then Compile_Time_Known_Value
                                      (Expression (Parent (Entity (P))))))
                   then