diff options
author | Bob Duff <duff@adacore.com> | 2021-03-17 12:14:12 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-06-18 04:36:50 -0400 |
commit | 537f0ce3078e4b1dd9f357ed4ed791e05024455a (patch) | |
tree | eb3ad8ff143c6f53ab0222dfdc25f8dddc59deb5 /gcc | |
parent | 7120f082181be2fc8cfc4f121809da71d2554503 (diff) | |
download | gcc-537f0ce3078e4b1dd9f357ed4ed791e05024455a.zip gcc-537f0ce3078e4b1dd9f357ed4ed791e05024455a.tar.gz gcc-537f0ce3078e4b1dd9f357ed4ed791e05024455a.tar.bz2 |
[Ada] Correct A'First (N) where N is an object name
gcc/ada/
* sem_attr.adb (Check_Array_Or_Scalar_Type): Use Expr_Value
instead of Intval, because the latter only exists in literals.
Remove Set_Etype on E1; setting the type is done elsewhere.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/sem_attr.adb | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 63b0f09..f9b17c7 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -1603,7 +1603,6 @@ package body Sem_Attr is -- Local variables - Dims : Int; Index : Entity_Id; -- Start of processing for Check_Array_Or_Scalar_Type @@ -1667,14 +1666,16 @@ package body Sem_Attr is Set_Etype (N, Base_Type (Etype (Index))); else - Dims := UI_To_Int (Intval (E1)); - - for J in 1 .. Dims - 1 loop - Next_Index (Index); - end loop; + declare + Udims : constant Uint := Expr_Value (E1); + Dims : constant Int := UI_To_Int (Udims); + begin + for J in 1 .. Dims - 1 loop + Next_Index (Index); + end loop; + end; Set_Etype (N, Base_Type (Etype (Index))); - Set_Etype (E1, Standard_Integer); end if; end if; end Check_Array_Or_Scalar_Type; |