aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2018-07-16 14:11:15 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-07-16 14:11:15 +0000
commitd2b73a3edb85564fce73b916ad7f7c65ea3ef74d (patch)
treef7769c876083d2280ce3368472a2a7fbccc1ee41 /gcc
parentf2f9cdad15a6eaadb93239092eb4441c535fa387 (diff)
downloadgcc-d2b73a3edb85564fce73b916ad7f7c65ea3ef74d.zip
gcc-d2b73a3edb85564fce73b916ad7f7c65ea3ef74d.tar.gz
gcc-d2b73a3edb85564fce73b916ad7f7c65ea3ef74d.tar.bz2
[Ada] Add a missing check for trivial predicates on non-discrete types
2018-07-16 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * sem_ch3.adb (Inherit_Predicate_Flags): A non-discrete type may have a static predicate (for example True) but has no static_discrete_predicate. From-SVN: r262716
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/sem_ch3.adb6
2 files changed, 11 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 59597a3..cd1aac0 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2018-07-16 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Inherit_Predicate_Flags): A non-discrete type may have a
+ static predicate (for example True) but has no
+ static_discrete_predicate.
+
2018-07-16 Hristian Kirtchev <kirtchev@adacore.com>
* exp_attr.adb (Build_Record_VS_Func): Handle corner cases dealing with
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 43055e6..9a9c150 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -18615,11 +18615,15 @@ package body Sem_Ch3 is
-- A named subtype does not inherit the predicate function of its
-- parent but an itype declared for a loop index needs the discrete
-- predicate information of its parent to execute the loop properly.
+ -- A non-discrete type may has a static predicate (for example True)
+ -- but has no static_discrete_predicate.
if Is_Itype (Subt) and then Present (Predicate_Function (Par)) then
Set_Subprograms_For_Type (Subt, Subprograms_For_Type (Par));
- if Has_Static_Predicate (Par) then
+ if Has_Static_Predicate (Par)
+ and then Is_Discrete_Type (Par)
+ then
Set_Static_Discrete_Predicate
(Subt, Static_Discrete_Predicate (Par));
end if;