Default initialization is not performed when an imported object is
declared, so there should also be no Default_Initial_Condition check
generated for such an object declaration.

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

2020-06-18  Steve Baird  <ba...@adacore.com>

gcc/ada/

        * exp_ch3.adb (Expand_N_Object_Declaration): Do not generate a
        default initial condition check for the declaration of an
        imported object.
--- gcc/ada/exp_ch3.adb
+++ gcc/ada/exp_ch3.adb
@@ -7516,6 +7516,7 @@ package body Exp_Ch3 is
         and then Has_DIC (Typ)
         and then Present (DIC_Procedure (Typ))
         and then not Has_Init_Expression (N)
+        and then not Is_Imported (Def_Id)
       then
          declare
             DIC_Call : constant Node_Id := Build_DIC_Call (Loc, Def_Id, Typ);

Reply via email to