aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2020-01-30 21:48:27 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2020-06-05 08:17:35 -0400
commitefd0843da81aafee053afe573bfa944bbd1ee32b (patch)
tree268f2edbc849dbee3860692987323b0df37cba4c
parent5620a9cd825f48f2ffa123de7c35a69f1dcd975f (diff)
downloadgcc-efd0843da81aafee053afe573bfa944bbd1ee32b.zip
gcc-efd0843da81aafee053afe573bfa944bbd1ee32b.tar.gz
gcc-efd0843da81aafee053afe573bfa944bbd1ee32b.tar.bz2
[Ada] Add No_Truncation flag on view conversion for GNAT-LLVM
2020-06-05 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * exp_attr.adb (Expand_N_Attribute_Reference) <Valid_Scalars>: Set the No_Truncation flag on the unchecked conversion built for scalar types.
-rw-r--r--gcc/ada/exp_attr.adb6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb
index 9d697961..1c9b971 100644
--- a/gcc/ada/exp_attr.adb
+++ b/gcc/ada/exp_attr.adb
@@ -7185,6 +7185,12 @@ package body Exp_Attr is
Unchecked_Convert_To (Val_Typ, New_Copy_Tree (Pref)),
Attribute_Name => Name_Valid);
+ -- Required by LLVM although the sizes are the same???
+
+ if Nkind (Prefix (Expr)) = N_Unchecked_Type_Conversion then
+ Set_No_Truncation (Prefix (Expr));
+ end if;
+
-- Validate the scalar components of an array by iterating over all
-- dimensions of the array while checking individual components.