aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2020-04-23 16:22:28 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2020-06-18 05:08:29 -0400
commit5b3950bed95136ad2b5e037e29daf3a464dc7cd5 (patch)
tree5380f76c098483c4b7931e4880918d29475b1295
parent0c32ab8232a40d8bb982c0ac13864d2290dc9336 (diff)
downloadgcc-5b3950bed95136ad2b5e037e29daf3a464dc7cd5.zip
gcc-5b3950bed95136ad2b5e037e29daf3a464dc7cd5.tar.gz
gcc-5b3950bed95136ad2b5e037e29daf3a464dc7cd5.tar.bz2
[Ada] Fix host/target confusion for attribute To_Address
2020-06-18 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * sem_attr.adb (Analyze_Attribute) <To_Address>: Use the address size of the target instead of the host when checking the value of a static expression. Also use standard idiom for exponentiation.
-rw-r--r--gcc/ada/sem_attr.adb6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index d444b9f..8045193 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -6274,9 +6274,9 @@ package body Sem_Attr is
if Is_OK_Static_Expression (E1) then
Val := Expr_Value (E1);
- if Val < -(2 ** UI_From_Int (Standard'Address_Size - 1))
+ if Val < -(Uint_2 ** (System_Address_Size - 1))
or else
- Val > 2 ** UI_From_Int (Standard'Address_Size) - 1
+ Val > Uint_2 ** System_Address_Size - 1
then
Error_Attr ("address value out of range for % attribute", E1);
end if;
@@ -6293,7 +6293,7 @@ package body Sem_Attr is
elsif Val < 0 then
Set_Etype (E1, Universal_Integer);
- -- Otherwise set type to Unsigned_64 to accommodate max values
+ -- Otherwise set type to Unsigned_64 to accommodate large values
else
Set_Etype (E1, Standard_Unsigned_64);