aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2021-07-01 17:57:16 +0200
committerEric Botcazou <ebotcazou@adacore.com>2021-07-01 18:13:12 +0200
commitcdf4576b201aa81fd853b06242b16e4215ead5a9 (patch)
tree7152f3be0aa3bb31cd5f33a43da9bbe69eaf8dd7 /gcc
parentcc8453012f75dc6dbd20bf3a94c4819a2bff46db (diff)
downloadgcc-cdf4576b201aa81fd853b06242b16e4215ead5a9.zip
gcc-cdf4576b201aa81fd853b06242b16e4215ead5a9.tar.gz
gcc-cdf4576b201aa81fd853b06242b16e4215ead5a9.tar.bz2
Use intermediate integer type with proper signedness
This is a minor regression present on mainline and 11 branch, whereby the value of the Enum_Rep attribute is always unsigned. gcc/ada/ PR ada/101094 * exp_attr.adb (Get_Integer_Type): Return an integer type with the same signedness as the input type.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/exp_attr.adb7
1 files changed, 3 insertions, 4 deletions
diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb
index 2e1cb85..af7f205d 100644
--- a/gcc/ada/exp_attr.adb
+++ b/gcc/ada/exp_attr.adb
@@ -1851,14 +1851,13 @@ package body Exp_Attr is
----------------------
function Get_Integer_Type (Typ : Entity_Id) return Entity_Id is
- Siz : constant Uint := Esize (Base_Type (Typ));
+ Siz : constant Uint := Esize (Base_Type (Typ));
begin
-- We need to accommodate invalid values of the base type since we
- -- accept them for Enum_Rep and Pos, so we reason on the Esize. And
- -- we use an unsigned type since the enumeration type is unsigned.
+ -- accept them for Enum_Rep and Pos, so we reason on the Esize.
- return Small_Integer_Type_For (Siz, Uns => True);
+ return Small_Integer_Type_For (Siz, Uns => Is_Unsigned_Type (Typ));
end Get_Integer_Type;
---------------------------------