aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch3.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2013-04-25 12:51:19 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2013-04-25 12:51:19 +0200
commitf197d2f29355314ccbf0a816f3ad20c20b506bef (patch)
tree6f7c96cd6779934fc8294e71c105f19678321d2f /gcc/ada/sem_ch3.adb
parentbbee5cc4b054ad87d3200f6d17e425040fbc50f6 (diff)
downloadgcc-f197d2f29355314ccbf0a816f3ad20c20b506bef.zip
gcc-f197d2f29355314ccbf0a816f3ad20c20b506bef.tar.gz
gcc-f197d2f29355314ccbf0a816f3ad20c20b506bef.tar.bz2
[multiple changes]
2013-04-25 Arnaud Charlet <charlet@adacore.com> * par-prag.adb: Fix typo. 2013-04-25 Hristian Kirtchev <kirtchev@adacore.com> * checks.adb (Apply_Predicate_Check): If the type has a static predicate and the expression is also static, check whether the expression satisfies the predicate. * sem_ch3.adb (Analyze_Object_Declaration): If the type has a static predicate and the expression is also static, see if the expression satisfies the predicate. * sem_util.adb: Alphabetize several routines. (Check_Expression_Against_Static_Predicate): New routine. * sem_util.ads (Check_Expression_Against_Static_Predicate): New routine. From-SVN: r198296
Diffstat (limited to 'gcc/ada/sem_ch3.adb')
-rw-r--r--gcc/ada/sem_ch3.adb17
1 files changed, 12 insertions, 5 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index bd0a519..0817773 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -3260,11 +3260,11 @@ package body Sem_Ch3 is
end if;
end if;
- -- Deal with predicate check before we start to do major rewriting.
- -- it is OK to initialize and then check the initialized value, since
- -- the object goes out of scope if we get a predicate failure. Note
- -- that we do this in the analyzer and not the expander because the
- -- analyzer does some substantial rewriting in some cases.
+ -- Deal with predicate check before we start to do major rewriting. It
+ -- is OK to initialize and then check the initialized value, since the
+ -- object goes out of scope if we get a predicate failure. Note that we
+ -- do this in the analyzer and not the expander because the analyzer
+ -- does some substantial rewriting in some cases.
-- We need a predicate check if the type has predicates, and if either
-- there is an initializing expression, or for default initialization
@@ -3277,6 +3277,13 @@ package body Sem_Ch3 is
or else
Is_Partially_Initialized_Type (T, Include_Implicit => False))
then
+ -- If the type has a static predicate and the expression is also
+ -- static, see if the expression satisfies the predicate.
+
+ if Present (E) then
+ Check_Expression_Against_Static_Predicate (E, T);
+ end if;
+
Insert_After (N,
Make_Predicate_Check (T, New_Occurrence_Of (Id, Loc)));
end if;