]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Add adequate guard before calling First_Rep_Item
authorYannick Moy <moy@adacore.com>
Fri, 23 Jul 2021 08:52:51 +0000 (10:52 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 22 Sep 2021 15:01:47 +0000 (15:01 +0000)
gcc/ada/

* sem_ch13.adb (Build_Predicate_Functions): Add guard.

gcc/ada/sem_ch13.adb

index 8bc849029820115c14ddcfdd7ef8fe6c6054e15d..595a741346f311e776772e7eb37f8fb854fa1fcf 100644 (file)
@@ -10104,7 +10104,10 @@ package body Sem_Ch13 is
          --  If the type is private, check whether full view has inherited
          --  predicates.
 
-         if Is_Private_Type (Typ) and then No (Ritem) then
+         if Is_Private_Type (Typ)
+           and then No (Ritem)
+           and then Present (Full_View (Typ))
+         then
             Ritem := First_Rep_Item (Full_View (Typ));
          end if;