aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2017-01-19 11:33:17 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2017-01-19 12:33:17 +0100
commitd9049d04d5fa172848374e395bf283c164a0f7fd (patch)
tree219185dab43ca3e16abe87cb7a0e572d8aa0b61b
parenta57c520e2b884f8f52c03625b3ce2ca838a9427a (diff)
downloadgcc-d9049d04d5fa172848374e395bf283c164a0f7fd.zip
gcc-d9049d04d5fa172848374e395bf283c164a0f7fd.tar.gz
gcc-d9049d04d5fa172848374e395bf283c164a0f7fd.tar.bz2
sem_dim.adb (Analyze_Dimension): Analyze object declaration and identifier nodes that do not come from source...
2017-01-19 Ed Schonberg <schonberg@adacore.com> * sem_dim.adb (Analyze_Dimension): Analyze object declaration and identifier nodes that do not come from source, to handle properly dimensionality check within an inlined body which inclddes both original operands and rewritten operands. This removes spurious dimensionality errors in the presence of front-end inlining, as well as in SPARK mode. From-SVN: r244614
-rw-r--r--gcc/ada/ChangeLog9
-rw-r--r--gcc/ada/sem_dim.adb21
2 files changed, 23 insertions, 7 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 5b22443..625643f 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,12 @@
+2017-01-19 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_dim.adb (Analyze_Dimension): Analyze object declaration and
+ identifier nodes that do not come from source, to handle properly
+ dimensionality check within an inlined body which inclddes both
+ original operands and rewritten operands. This removes spurious
+ dimensionality errors in the presence of front-end inlining,
+ as well as in SPARK mode.
+
2017-01-16 Jakub Jelinek <jakub@redhat.com>
PR driver/49726
diff --git a/gcc/ada/sem_dim.adb b/gcc/ada/sem_dim.adb
index 44794ba..2c57bcb 100644
--- a/gcc/ada/sem_dim.adb
+++ b/gcc/ada/sem_dim.adb
@@ -1122,16 +1122,22 @@ package body Sem_Dim is
-- Aspect is an Ada 2012 feature. Note that there is no need to check
-- dimensions for nodes that don't come from source, except for subtype
-- declarations where the dimensions are inherited from the base type,
- -- and for explicit dereferences generated when expanding iterators.
+ -- for explicit dereferences generated when expanding iterators, and
+ -- for object declarations generated for inlining.
if Ada_Version < Ada_2012 then
return;
- elsif not Comes_From_Source (N)
- and then Nkind (N) /= N_Subtype_Declaration
- and then Nkind (N) /= N_Explicit_Dereference
- then
- return;
+ elsif not Comes_From_Source (N) then
+ if Nkind_In (N, N_Explicit_Dereference,
+ N_Identifier,
+ N_Object_Declaration,
+ N_Subtype_Declaration)
+ then
+ null;
+ else
+ return;
+ end if;
end if;
case Nkind (N) is
@@ -2138,7 +2144,8 @@ package body Sem_Dim is
end if;
end if;
- -- Removal of dimensions in expression
+ -- Remove dimensions in expression after checking consistency
+ -- with given type.
Remove_Dimensions (Expr);
end if;