aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2021-03-26 09:36:49 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2021-06-21 06:45:04 -0400
commit05447313c9acb24e0fad6305ad333077707de9ba (patch)
tree2017bb14c6bce4be73747989411daf1ee4a2e2ac /gcc
parentb1955e0e6dbcc376c8a05ea51751dcce7e210266 (diff)
downloadgcc-05447313c9acb24e0fad6305ad333077707de9ba.zip
gcc-05447313c9acb24e0fad6305ad333077707de9ba.tar.gz
gcc-05447313c9acb24e0fad6305ad333077707de9ba.tar.bz2
[Ada] Disable wrong computation of offsets within multidimensional arrays
gcc/ada/ * sem_util.adb (Indexed_Component_Bit_Offset): Return an unknown offset for components within multidimensional arrays; remove redundant parens.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_util.adb8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 2e102b9..44a5684 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -14827,6 +14827,12 @@ package body Sem_Util is
return No_Uint;
end if;
+ -- Do not attempt to compute offsets within multi-dimensional arrays
+
+ if Present (Next_Index (Ind)) then
+ return No_Uint;
+ end if;
+
if Nkind (Ind) = N_Subtype_Indication then
Ind := Constraint (Ind);
@@ -14843,7 +14849,7 @@ package body Sem_Util is
-- Return the scaled offset
- return Off * (Expr_Value (Exp) - Expr_Value (Low_Bound ((Ind))));
+ return Off * (Expr_Value (Exp) - Expr_Value (Low_Bound (Ind)));
end Indexed_Component_Bit_Offset;
-----------------------------