aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2018-05-31 10:44:45 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-05-31 10:44:45 +0000
commitdfd2da005e1023bbcbcc0390bbb360c1b8a43f77 (patch)
treeed510ce3a00298bd51cfb3e69316b966008dbdea /gcc
parent5b87c1fe09edc8ce6a105af9d27ae9353656d6f0 (diff)
downloadgcc-dfd2da005e1023bbcbcc0390bbb360c1b8a43f77.zip
gcc-dfd2da005e1023bbcbcc0390bbb360c1b8a43f77.tar.gz
gcc-dfd2da005e1023bbcbcc0390bbb360c1b8a43f77.tar.bz2
[Ada] Convert operands of generated code to Standard.Unsigned for modular ops.
2018-05-31 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * exp_ch4.adb (Expand_Modular_Addition, Expand_Modular_Subtraction): Convert all operands of the generated code to Standard.Unsigned, to prevent spurious visibility errors. This is needed when the generated expansion involves a modular index type of an array type, and the index type is not immediately visible. From-SVN: r260993
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog8
-rw-r--r--gcc/ada/exp_ch4.adb9
2 files changed, 15 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 96c90c6..9f47a77 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,11 @@
+2018-05-31 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch4.adb (Expand_Modular_Addition, Expand_Modular_Subtraction):
+ Convert all operands of the generated code to Standard.Unsigned, to
+ prevent spurious visibility errors. This is needed when the generated
+ expansion involves a modular index type of an array type, and the index
+ type is not immediately visible.
+
2018-05-30 Piotr Trojanek <trojanek@adacore.com>
* einfo.ads (Package_Instantiation): Update comment after a routine
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index d110385..50333d3 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -4057,8 +4057,12 @@ package body Exp_Ch4 is
Else_Expr : constant Node_Id := New_Op_Node (N_Op_Subtract,
Loc);
begin
+ -- To prevent spurious visibility issues, convert all
+ -- operands to Standard.Unsigned.
+
Set_Left_Opnd (Cond_Expr,
- New_Copy_Tree (Left_Opnd (N)));
+ Unchecked_Convert_To (Standard_Unsigned,
+ New_Copy_Tree (Left_Opnd (N))));
Set_Right_Opnd (Cond_Expr,
Make_Integer_Literal (Loc, Mod_Minus_Right));
Append_To (Exprs, Cond_Expr);
@@ -4180,7 +4184,8 @@ package body Exp_Ch4 is
Loc);
begin
Set_Left_Opnd (Cond_Expr,
- New_Copy_Tree (Left_Opnd (N)));
+ Unchecked_Convert_To (Standard_Unsigned,
+ New_Copy_Tree (Left_Opnd (N))));
Set_Right_Opnd (Cond_Expr,
Make_Integer_Literal (Loc, Intval (Right_Opnd (N))));
Append_To (Exprs, Cond_Expr);