aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2022-04-14 13:08:38 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2022-05-19 14:05:31 +0000
commit4b3cf8416424a86c312e52c47429d869c45875ce (patch)
tree1a9dfce98658c856cf68587d05f591980fc401ea /gcc
parent8a03acaace9544249583e630153e73d53ccfaec7 (diff)
downloadgcc-4b3cf8416424a86c312e52c47429d869c45875ce.zip
gcc-4b3cf8416424a86c312e52c47429d869c45875ce.tar.gz
gcc-4b3cf8416424a86c312e52c47429d869c45875ce.tar.bz2
[Ada] Preserve and reuse original type in Narrow_Large_Operation
Instead of using that of Original_Node (N) after rewriting, which does not work if N had previously been rewritten. gcc/ada/ * exp_ch4.adb (Narrow_Large_Operation): Preserve and reuse Etype.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/exp_ch4.adb4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 9e86b4d..75f0e56 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -14108,6 +14108,7 @@ package body Exp_Ch4 is
procedure Narrow_Large_Operation (N : Node_Id) is
Kind : constant Node_Kind := Nkind (N);
+ Otyp : constant Entity_Id := Etype (N);
In_Rng : constant Boolean := Kind = N_In;
Binary : constant Boolean := Kind in N_Binary_Op or else In_Rng;
Compar : constant Boolean := Kind in N_Op_Compare or else In_Rng;
@@ -14262,8 +14263,7 @@ package body Exp_Ch4 is
-- Analyze it with the comparison type and checks suppressed since
-- the conversions of the operands cannot overflow.
- Analyze_And_Resolve
- (N, Etype (Original_Node (N)), Suppress => Overflow_Check);
+ Analyze_And_Resolve (N, Otyp, Suppress => Overflow_Check);
else
-- Analyze it with the narrower type and checks suppressed, but only