From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by sourceware.org (Postfix) with ESMTPS id C927F3857B98 for ; Mon, 5 Sep 2022 07:26:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C927F3857B98 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wr1-x432.google.com with SMTP id k9so10118478wri.0 for ; Mon, 05 Sep 2022 00:26:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date; bh=KIxECnYDvGt7qI06FEKCVWmLszPod8JdRctIDVPgFsc=; b=SJAppR3egERKoxptSbsvSAzE3R0tA/SngeGfwvK4B8FjjH+IeUT2sJ0c8E5lktmdzw R8nGsc4eXo8loMv9IG5+sXjiBe95j33zZYm/gY5vYjHHDgWLi91Fyvuj8Vw1SuTqZkI8 78MSLY5N7lFiQw2FvlDt8gFlw91svIhirlJWwd/fpv/Fi0EjGJr+NHKWNqCC2JEpn1pV U81ysXjjZiGiCCctdbr2yAmlmUvLBQeqFv6GJDZkATuEi4eZDzKSipQzs121uW5jcRL8 iyg2dc0KFeM1SomzgVQtzszpzLVb3qRQiIoOr/XbkZt6a2E73fk3FajaCZi4ZYyE53nM i+Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=KIxECnYDvGt7qI06FEKCVWmLszPod8JdRctIDVPgFsc=; b=hSizsugADbbOaI9qV1S9m2egjMZjwHqqdmFg4yC8BYgUgeAZho1DxKN0VI4O2GYe4G A/5VQYXPFtqHYAx1vwr7YDc9uHT7zMmQifJKb3yVl1Wrdth/3GZB4GWCANsrLWS3BpDE rA43DsJVwX7iNziVR8U/c22Mck4BuLaAQJSHTVQyzhtQx03+nEqsueXvUPDpjVcm4RXS kafTHLBLIUv4r+4yNlhXjj2Vf5x9/ayJ5ApF9exfrDYED3dDHj1FJRC8gXMwHYqv4Hus cOSZPqxTR/7Hf2db7Ylhe3O1hoV1rB1TnwHX+wTgwpiiJWFnoGibMy1QVgmLams06C5V xy1w== X-Gm-Message-State: ACgBeo3TXyKDx3ygyXKHYHYrK0IRUjbb1FUpfQKW8jUNfoHg3zaV+sX7 WBNV/SC7bkysyD5tlrAA4Fml9ixIbBW8lQ== X-Google-Smtp-Source: AA6agR6GlipcQZaIs6cIXV9mY5iOdmSIut299VV9hrkNcIFuTglx5IC4b1erXJYGtPwV1ED5Ujf2Gg== X-Received: by 2002:a05:6000:1e1e:b0:226:e5c9:4b08 with SMTP id bj30-20020a0560001e1e00b00226e5c94b08mr16148942wrb.648.1662362771438; Mon, 05 Sep 2022 00:26:11 -0700 (PDT) Received: from poulhies-Precision-5550 (static-176-191-105-132.ftth.abo.bbox.fr. [176.191.105.132]) by smtp.gmail.com with ESMTPSA id bt24-20020a056000081800b0022377df817fsm8333028wrb.58.2022.09.05.00.26.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 00:26:10 -0700 (PDT) Date: Mon, 5 Sep 2022 09:26:10 +0200 From: Marc =?iso-8859-1?Q?Poulhi=E8s?= To: gcc-patches@gcc.gnu.org Cc: Steve Baird Subject: [Ada] Bad Default_Initial_Condition check for a not-default-initialized object Message-ID: <20220905072610.GA1174775@poulhies-Precision-5550> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="Dxnq1zWXvFF0Q93v" Content-Disposition: inline X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --Dxnq1zWXvFF0Q93v Content-Type: text/plain; charset=us-ascii Content-Disposition: inline No Default_Initial_Condition check should be generated for an object declaration that has an explicit initial value. Previously this was implemented by testing the Has_Init_Expression flag, but this only works if the object declaration was created by the parser (since only the parser sets that attribute, at least currently). Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch3.adb (Expand_N_Object_Declaration): In deciding whether to emit a DIC check, we were previously testing the Has_Init_Expression flag. Continue to test that flag as before, but add a test for the syntactic presence of an initial value in the object declaration. This new test would not supersede the old test in the case where an explicit initial value has been eliminated as part of some tree transformation. --Dxnq1zWXvFF0Q93v Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -7850,6 +7850,7 @@ package body Exp_Ch3 is and then Present (DIC_Procedure (Typ)) and then not Has_Null_Body (DIC_Procedure (Typ)) and then not Has_Init_Expression (N) + and then No (Expr) and then not Is_Imported (Def_Id) then declare --Dxnq1zWXvFF0Q93v--