aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ada/ChangeLog13
-rw-r--r--gcc/ada/exp_ch4.adb9
-rw-r--r--gcc/ada/sem_ch10.adb7
-rw-r--r--gcc/ada/sem_res.adb7
4 files changed, 33 insertions, 3 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 101ea652..33383e7 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,16 @@
+2016-10-12 Justin Squirek <squirek@adacore.com>
+
+ * sem_ch10.adb (Remove_Limited_With_Clause): Add a check to
+ detect accidental visibility.
+
+2016-10-12 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch4.adb (Expand_Allocator): If the expression is a qualified
+ expression, add a predicate check after the constraint check.
+ * sem_res.adb (Resolve_Qualified_Expression): If context is an
+ allocator, do not apply predicate check, as it will be done when
+ allocator is expanded.
+
2016-10-12 Bob Duff <duff@adacore.com>
* xref_lib.adb: Use renamings-of-slices to ensure
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index f6a5c2c..77b7012 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -4279,8 +4279,13 @@ package body Exp_Ch4 is
-- in the aggregate might not match the subtype mark in the allocator.
if Nkind (Expression (N)) = N_Qualified_Expression then
- Apply_Constraint_Check
- (Expression (Expression (N)), Etype (Expression (N)));
+ declare
+ Exp : constant Node_Id := Expression (Expression (N));
+ Typ : constant Entity_Id := Etype (Expression (N));
+ begin
+ Apply_Constraint_Check (Exp, Typ);
+ Apply_Predicate_Check (Exp, Typ);
+ end;
Expand_Allocator_Expression (N);
return;
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb
index 86dbad0..115b2dd 100644
--- a/gcc/ada/sem_ch10.adb
+++ b/gcc/ada/sem_ch10.adb
@@ -6377,6 +6377,13 @@ package body Sem_Ch10 is
-- Limited_Withed_Unit.
else
+ -- If the limited_with_clause is in some other unit in the context
+ -- then it is not visible in the main unit.
+
+ if not In_Extended_Main_Source_Unit (N) then
+ Set_Is_Immediately_Visible (P, False);
+ end if;
+
-- Real entities that are type or subtype declarations were hidden
-- from visibility at the point of installation of the limited-view.
-- Now we recover the previous value of the hidden attribute.
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 47a6725..86691d9 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -9495,7 +9495,12 @@ package body Sem_Res is
then
null;
- elsif Nkind (N) = N_Qualified_Expression then
+ -- In the case of a qualified expression in an allocator, the check
+ -- is applied when expanding the allocator, so avoid redundant check.
+
+ elsif Nkind (N) = N_Qualified_Expression
+ and then Nkind (Parent (N)) /= N_Allocator
+ then
Apply_Predicate_Check (N, Target_Typ);
end if;
end if;