aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_case.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2014-07-16 16:37:34 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2014-07-16 16:37:34 +0200
commitc624a26b6ab44115eb42c76d93eebffcaa1df15c (patch)
tree3cba23eae91006f3808a22c301a3f154e1375db4 /gcc/ada/sem_case.adb
parentff1f1705ffdb2a6d4e7682a3499e37fcaa1dfa18 (diff)
downloadgcc-c624a26b6ab44115eb42c76d93eebffcaa1df15c.zip
gcc-c624a26b6ab44115eb42c76d93eebffcaa1df15c.tar.gz
gcc-c624a26b6ab44115eb42c76d93eebffcaa1df15c.tar.bz2
[multiple changes]
2014-07-16 Vincent Celier <celier@adacore.com> * gnatls.adb (Normalize): New function. (Gnatls): Get the target parameters. On targets other than VMS, normalize the path names in the source search path, the object search path and the project search path. 2014-07-16 Ed Schonberg <schonberg@adacore.com> * sem_case.adb: Avoid self-checking of case expressions in dynamic predicates. 2014-07-16 Robert Dewar <dewar@adacore.com> * gnat_rm.texi: Document effect of Suppress_Initialization on tags and discriminants. From-SVN: r212658
Diffstat (limited to 'gcc/ada/sem_case.adb')
-rw-r--r--gcc/ada/sem_case.adb22
1 files changed, 13 insertions, 9 deletions
diff --git a/gcc/ada/sem_case.adb b/gcc/ada/sem_case.adb
index b3f47a6..3a2f815 100644
--- a/gcc/ada/sem_case.adb
+++ b/gcc/ada/sem_case.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1996-2013, Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2014, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -23,6 +23,7 @@
-- --
------------------------------------------------------------------------------
+with Aspects; use Aspects;
with Atree; use Atree;
with Einfo; use Einfo;
with Errout; use Errout;
@@ -645,9 +646,6 @@ package body Sem_Case is
Bounds_Hi : constant Node_Id := Type_High_Bound (Bounds_Type);
Bounds_Lo : constant Node_Id := Type_Low_Bound (Bounds_Type);
- Has_Predicate : constant Boolean :=
- Is_Static_Subtype (Bounds_Type)
- and then Present (Static_Predicate (Bounds_Type));
Num_Choices : constant Nat := Choice_Table'Last;
Choice : Node_Id;
@@ -681,11 +679,17 @@ package body Sem_Case is
Sorting.Sort (Positive (Choice_Table'Last));
- -- The type covered by the list of choices is actually a static subtype
- -- subject to a static predicate. The predicate defines subsets of legal
- -- values and requires finer grained analysis.
-
- if Has_Predicate then
+ -- If the type covered by the list of choices is actually a static
+ -- subtype subject to a static predicate, then the predicate defines
+ -- subsets of legal values and we must verify that the branches of the
+ -- case match those subsets. If there is no static_predicate there is no
+ -- compiler check to perform. In particular we don't want any checks on
+ -- a case expression that itself appears as the expression of a dynamic
+ -- predicate. A case expression that defines a static predicate is
+ -- expanded earlier into a membership test and is not subject to this
+ -- spurious self-check either.
+
+ if Has_Aspect (Bounds_Type, Aspect_Static_Predicate) then
Pred := First (Static_Predicate (Bounds_Type));
Prev_Lo := Uint_Minus_1;
Prev_Hi := Uint_Minus_1;