aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2020-05-16 15:42:04 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2020-07-08 10:55:48 -0400
commit19036072c6f7db967a3ecd1b2f3b9440ddbd68d4 (patch)
tree89141fc00f7b975284b3b5e1d419412921158281
parent760df6d296b8fc59796f42dca5eb14012fbfa28b (diff)
downloadgcc-19036072c6f7db967a3ecd1b2f3b9440ddbd68d4.zip
gcc-19036072c6f7db967a3ecd1b2f3b9440ddbd68d4.tar.gz
gcc-19036072c6f7db967a3ecd1b2f3b9440ddbd68d4.tar.bz2
[Ada] Small tweak to Narrow_Large_Operation procedure
gcc/ada/ * exp_ch4.adb (Narrow_Large_Operation): Use the base type instead of the first subtype of standard integer types as narrower type.
-rw-r--r--gcc/ada/exp_ch4.adb8
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 6a0b1ce..b40864f 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -14067,13 +14067,15 @@ package body Exp_Ch4 is
return;
end if;
- -- Now pick the narrower type according to the size
+ -- Now pick the narrower type according to the size. We use the base
+ -- type instead of the first subtype because operations are done in
+ -- the base type, so this avoids the need for useless conversions.
if Nsiz <= RM_Size (Standard_Integer) then
- Ntyp := Standard_Integer;
+ Ntyp := Etype (Standard_Integer);
elsif Nsiz <= RM_Size (Standard_Long_Long_Integer) then
- Ntyp := Standard_Long_Long_Integer;
+ Ntyp := Etype (Standard_Long_Long_Integer);
else
return;