aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJavier Miranda <miranda@adacore.com>2019-09-17 08:02:51 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-09-17 08:02:51 +0000
commit0d4fcc9f622ee428849091c51108a4823819e9a6 (patch)
treecec93904fb75525109eb13ce28f9bd440916f28b /gcc
parent1e0a3cc4ca87b57b2a9b8a02ff20bacdce6146a3 (diff)
downloadgcc-0d4fcc9f622ee428849091c51108a4823819e9a6.zip
gcc-0d4fcc9f622ee428849091c51108a4823819e9a6.tar.gz
gcc-0d4fcc9f622ee428849091c51108a4823819e9a6.tar.bz2
[Ada] Missing propagation of Has_Predicates in cloned subtypes
The frontend silently skips propagating attributes Has_Predicates and Predicate function to the internally built cloned subtype. This change does not affect the functionality of the compiler; it leaves more clean the decoration of internal entities. 2019-09-17 Javier Miranda <miranda@adacore.com> gcc/ada/ * sem_ch3.adb (Complete_Private_Subtype): Propagate attributes Has_Attributes and Predicate_Function to the cloned subtype. From-SVN: r275795
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/sem_ch3.adb12
2 files changed, 17 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 8f4d57e..36a7dde 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2019-09-17 Javier Miranda <miranda@adacore.com>
+
+ * sem_ch3.adb (Complete_Private_Subtype): Propagate attributes
+ Has_Attributes and Predicate_Function to the cloned subtype.
+
2019-09-17 Eric Botcazou <ebotcazou@adacore.com>
* sem.adb (Do_Analyze): Save Style_Check_Max_Line_Length on
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 257761a..864b08e 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -12509,6 +12509,18 @@ package body Sem_Ch3 is
-- Show Full is simply a renaming of Full_Base
Set_Cloned_Subtype (Full, Full_Base);
+
+ -- Propagate predicates
+
+ if Has_Predicates (Full_Base) then
+ Set_Has_Predicates (Full);
+
+ if Present (Predicate_Function (Full_Base))
+ and then No (Predicate_Function (Full))
+ then
+ Set_Predicate_Function (Full, Predicate_Function (Full_Base));
+ end if;
+ end if;
end if;
-- It is unsafe to share the bounds of a scalar type, because the Itype