[Ada] No Default_Initial_Condition check when declaring an imported object

Message ID 20200618091320.GA2113@adacore.com
State New
Headers show
Series
  • [Ada] No Default_Initial_Condition check when declaring an imported object
Related show

Commit Message

Pierre-Marie de Rodat June 18, 2020, 9:13 a.m.
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  <baird@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.

Patch

--- 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);