aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYannick Moy <moy@adacore.com>2019-08-13 08:06:55 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-08-13 08:06:55 +0000
commitfa0c3ab8c54e8cba46c26c3d29f3e7be435e126a (patch)
tree11e38229b6417efe1a0d40a55bdf112c4128a9df
parent943c82d7b9bc15161ac344953b2deb0a4121b279 (diff)
downloadgcc-fa0c3ab8c54e8cba46c26c3d29f3e7be435e126a.zip
gcc-fa0c3ab8c54e8cba46c26c3d29f3e7be435e126a.tar.gz
gcc-fa0c3ab8c54e8cba46c26c3d29f3e7be435e126a.tar.bz2
[Ada] Avoid spurious errors on dimensionality checking in GNATprove
Complete the partial treatment that was started in r273405. Instead of checking for the special case of nodes inside inlined bodies at the call site, check for this condition inside the top-level procedures called for dimensionality checking. There is no impact on compilation. 2019-08-13 Yannick Moy <moy@adacore.com> gcc/ada/ * sem_dim.adb (Analyze_Dimension, Analyze_Dimension_Array_Aggregate, Analyze_Dimension_Call, Analyze_Dimension_Extension_Or_Record_Aggregate): Return immediately when inside an inlined body. * sem_res.adb (Resolve_Call): Remove special checking now done inside Analyze_Dimension_Call. From-SVN: r274339
-rw-r--r--gcc/ada/ChangeLog9
-rw-r--r--gcc/ada/sem_dim.adb20
-rw-r--r--gcc/ada/sem_res.adb4
3 files changed, 25 insertions, 8 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 5a9a9cc..9ae91db 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,12 @@
+2019-08-13 Yannick Moy <moy@adacore.com>
+
+ * sem_dim.adb (Analyze_Dimension,
+ Analyze_Dimension_Array_Aggregate, Analyze_Dimension_Call,
+ Analyze_Dimension_Extension_Or_Record_Aggregate): Return
+ immediately when inside an inlined body.
+ * sem_res.adb (Resolve_Call): Remove special checking now done
+ inside Analyze_Dimension_Call.
+
2019-08-13 Justin Squirek <squirek@adacore.com>
* exp_ch4.adb (Expand_N_Allocator): Add condition to detect
diff --git a/gcc/ada/sem_dim.adb b/gcc/ada/sem_dim.adb
index 2bcccd2..177902f 100644
--- a/gcc/ada/sem_dim.adb
+++ b/gcc/ada/sem_dim.adb
@@ -1142,6 +1142,11 @@ package body Sem_Dim is
if Ada_Version < Ada_2012 then
return;
+ -- Inlined bodies have already been checked for dimensionality
+
+ elsif In_Inlined_Body then
+ return;
+
elsif not Comes_From_Source (N) then
if Nkind_In (N, N_Explicit_Dereference,
N_Identifier,
@@ -1245,10 +1250,13 @@ package body Sem_Dim is
-- Aspect is an Ada 2012 feature. Nothing to do here if the component
-- base type is not a dimensioned type.
+ -- Inlined bodies have already been checked for dimensionality.
+
-- Note that here the original node must come from source since the
-- original array aggregate may not have been entirely decorated.
if Ada_Version < Ada_2012
+ or else In_Inlined_Body
or else not Comes_From_Source (Original_Node (N))
or else not Has_Dimension_System (Base_Type (Comp_Typ))
then
@@ -1634,10 +1642,11 @@ package body Sem_Dim is
begin
-- Aspect is an Ada 2012 feature. Note that there is no need to check
- -- dimensions for calls that don't come from source, or those that may
- -- have semantic errors.
+ -- dimensions for calls in inlined bodies, or calls that don't come
+ -- from source, or those that may have semantic errors.
if Ada_Version < Ada_2012
+ or else In_Inlined_Body
or else not Comes_From_Source (N)
or else Error_Posted (N)
then
@@ -1966,11 +1975,12 @@ package body Sem_Dim is
begin
-- Aspect is an Ada 2012 feature. Note that there is no need to check
- -- dimensions for aggregates that don't come from source, or if we are
- -- within an initialization procedure, whose expressions have been
- -- checked at the point of record declaration.
+ -- dimensions in inlined bodies, or for aggregates that don't come
+ -- from source, or if we are within an initialization procedure, whose
+ -- expressions have been checked at the point of record declaration.
if Ada_Version < Ada_2012
+ or else In_Inlined_Body
or else not Comes_From_Source (N)
or else Inside_Init_Proc
then
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index ecd8bc0..759887c 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -6952,9 +6952,7 @@ package body Sem_Res is
-- Check the dimensions of the actuals in the call. For function calls,
-- propagate the dimensions from the returned type to N.
- if not In_Inlined_Body then
- Analyze_Dimension_Call (N, Nam);
- end if;
+ Analyze_Dimension_Call (N, Nam);
-- All done, evaluate call and deal with elaboration issues