[Ada] Avoid frontend assertion failure

Arnaud Charlet charlet@adacore.com
Mon Jul 13 08:44:00 GMT 2009


This patch avoids the failure of an assertion in the frontend
while traversing the homonym chain, looking at a potentially
overridden subprogram that belongs to an interface type.

After this patch the following test compiles without errors.

package Pak is
   type I is limited interface;
   generic
   package Gen is
      type T is private;
   private
      procedure Pouet (X : T);
      type T is tagged null record;
   end Gen;
end Pak;

package body Pak is
   package body Gen is
      procedure Pouet (X : T) is begin null; end;
   end Gen;
end Pak;

with Pak;
package Tsk is
   package Inst is new Pak.Gen;
   type New_T is new Inst.T;

   task type TT is new Pak.I with
      entry Pouet;
   end TT;
end Tsk;

Command: gcc -c -gnat05 tsk.ads

Tested on x86_64-pc-linux-gnu, committed on trunk

2009-07-13  Javier Miranda  <miranda@adacore.com>

	* sem_ch6.adb (Check_Synchronized_Overriding): Add missing check before
	reading the Is_Interface attribute of the dispatching type.

-------------- next part --------------
Index: sem_ch6.adb
===================================================================
--- sem_ch6.adb	(revision 149526)
+++ sem_ch6.adb	(working copy)
@@ -7175,6 +7175,7 @@ package body Sem_Ch6 is
                  or else not Is_Overloadable (Subp)
                  or else not Is_Primitive (Subp)
                  or else not Is_Dispatching_Operation (Subp)
+                 or else not Present (Find_Dispatching_Type (Subp))
                  or else not Is_Interface (Find_Dispatching_Type (Subp))
                then
                   null;


More information about the Gcc-patches mailing list