aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch4.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2016-06-16 11:52:17 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2016-06-16 11:52:17 +0200
commita8a42b933c5dc135080120d0a1d115c602a328fb (patch)
tree4e3a1428b51984b87462326c45d6de2571028f17 /gcc/ada/sem_ch4.adb
parentfb757f7da43d13603d3d8b821f62076336e412a9 (diff)
downloadgcc-a8a42b933c5dc135080120d0a1d115c602a328fb.zip
gcc-a8a42b933c5dc135080120d0a1d115c602a328fb.tar.gz
gcc-a8a42b933c5dc135080120d0a1d115c602a328fb.tar.bz2
[multiple changes]
2016-06-16 Javier Miranda <miranda@adacore.com> * sem_res.adb (Resolve): Under relaxed RM semantics silently replace occurrences of null by System.Null_Address. * sem_ch4.adb (Analyze_One_Call, Operator_Check): Under relaxed RM semantics silently replace occurrences of null by System.Null_Address. * sem_util.ad[sb] (Null_To_Null_Address_Convert_OK): New subprogram. (Replace_Null_By_Null_Address): New subprogram. 2016-06-16 Bob Duff <duff@adacore.com> * exp_util.adb (Is_Controlled_Function_Call): This was missing the case where the call is in prefix format, with named notation, as in Obj.Func (Formal => Actual). From-SVN: r237508
Diffstat (limited to 'gcc/ada/sem_ch4.adb')
-rw-r--r--gcc/ada/sem_ch4.adb34
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index a109cd0..66a2acf 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -3397,6 +3397,18 @@ package body Sem_Ch4 is
Next_Actual (Actual);
Next_Formal (Formal);
+ -- Under relaxed RM semantics silently replace occurrences of
+ -- null by System.Address_Null. We only do this if we know that
+ -- an error will otherwise be issued.
+
+ elsif Null_To_Null_Address_Convert_OK (Actual, Etype (Formal))
+ and then (Report and not Is_Indexed and not Is_Indirect)
+ then
+ Replace_Null_By_Null_Address (Actual);
+ Analyze_And_Resolve (Actual, Etype (Formal));
+ Next_Actual (Actual);
+ Next_Formal (Formal);
+
-- For an Ada 2012 predicate or invariant, a call may mention
-- an incomplete type, while resolution of the corresponding
-- predicate function may see the full view, as a consequence
@@ -6806,6 +6818,20 @@ package body Sem_Ch4 is
return;
end;
+
+ -- Under relaxed RM semantics silently replace occurrences of
+ -- null by System.Address_Null.
+
+ elsif Null_To_Null_Address_Convert_OK (N) then
+ Replace_Null_By_Null_Address (N);
+
+ if Nkind_In (N, N_Op_Ge, N_Op_Gt, N_Op_Le, N_Op_Lt) then
+ Analyze_Comparison_Op (N);
+ else
+ Analyze_Arithmetic_Op (N);
+ end if;
+
+ return;
end if;
-- Comparisons on A'Access are common enough to deserve a
@@ -6875,6 +6901,14 @@ package body Sem_Ch4 is
Unchecked_Convert_To (Etype (L), Relocate_Node (R)));
Analyze_Equality_Op (N);
return;
+
+ -- Under relaxed RM semantics silently replace occurrences of
+ -- null by System.Address_Null.
+
+ elsif Null_To_Null_Address_Convert_OK (N) then
+ Replace_Null_By_Null_Address (N);
+ Analyze_Equality_Op (N);
+ return;
end if;
end if;