[Ada] Fix small fallout of change for 'Pos and 'Val attributes
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 10 Apr 2020 09:20:55 +0000 (11:20 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 17 Jun 2020 08:13:59 +0000 (04:13 -0400)
2020-06-17  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* exp_fixd.adb (Build_Conversion): Also preserve the
Conversion_OK flag of an inner conversion.

gcc/ada/exp_fixd.adb

index 621ec7a..d956278 100644 (file)
@@ -262,7 +262,8 @@ package body Exp_Fixd is
          --  Remove inner conversion if both inner and outer conversions are
          --  to integer types, since the inner one serves no purpose (except
          --  perhaps to set rounding, so we preserve the Rounded_Result flag)
-         --  and also we preserve the range check flag on the inner operand
+         --  and also preserve the Conversion_OK and Do_Range_Check flags of
+         --  the inner conversion.
 
          if Is_Integer_Type (Typ)
            and then Is_Integer_Type (Etype (Expr))
@@ -273,6 +274,7 @@ package body Exp_Fixd is
                 Subtype_Mark => New_Occurrence_Of (Typ, Loc),
                 Expression   => Expression (Expr));
             Set_Rounded_Result (Result, Rounded_Result_Set (Expr));
+            Set_Conversion_OK  (Result, Conversion_OK (Expr));
             Rcheck := Rcheck or Do_Range_Check (Expr);
 
          --  For all other cases, a simple type conversion will work