Routine Make_DT that generates dispatch tables for tagged types might be
called twice: when the tagged type is frozen (if it requires freezing)
and once the enclosing package is fully analyzed. The Has_Dispatch_Table
flag on a type prevents dispatch tables being generated twice. However,
this flag was only set in ordinary compilation mode, not in the CodePeer
mode.

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

gcc/ada/

        * exp_disp.adb (Make_DT): Move call to Set_Has_Dispatch_Table,
        so it is executed regardless of the Generate_SCIL mode.
diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb
--- a/gcc/ada/exp_disp.adb
+++ b/gcc/ada/exp_disp.adb
@@ -6610,7 +6610,6 @@ package body Exp_Disp is
       Append_Elmt (DT, DT_Decl);
 
       Analyze_List (Result, Suppress => All_Checks);
-      Set_Has_Dispatch_Table (Typ);
 
       --  Mark entities containing dispatch tables. Required by the backend to
       --  handle them properly.
@@ -6643,6 +6642,8 @@ package body Exp_Disp is
 
    <<Leave_SCIL>>
 
+      Set_Has_Dispatch_Table (Typ);
+
       --  Register the tagged type in the call graph nodes table
 
       Register_CG_Node (Typ);


Reply via email to