Message ID | 20220905072610.GA1174775@poulhies-Precision-5550 |
---|---|
State | New, archived |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp59094wrt; Mon, 5 Sep 2022 00:37:52 -0700 (PDT) X-Google-Smtp-Source: AA6agR53G59rBmjtbwXs0WZqdHc3Wto6Dy9W+dpPKhKj0tKakvfZMLye0QDYOve5SMSDHFBj8JlG X-Received: by 2002:a05:6402:40d0:b0:43f:8f56:6b0e with SMTP id z16-20020a05640240d000b0043f8f566b0emr43387335edb.380.1662363472580; Mon, 05 Sep 2022 00:37:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662363472; cv=none; d=google.com; s=arc-20160816; b=tFU242vjeZfQN5/g1WNMDQaefoyN4leSPNS0ldOywmjnyiM2bQl/uj7/SRyTMOHwrG synrieW5rAy3oA6Klo9GuQ7SxEfwy33F2YNDrhWfsdqGTR/lOtrUC2AfBbXyk4SpUCc8 Xsur4fMmiMam2oQU+jhOlDunRx9juNGOTMxkqYlumJ5jNN5+iW/j6Z96Id5AtmyprNkS UMIpkG7B6o6kQrlfD37rsiwKxNpxKZ/B7K8N6F5QH3zj7MkIt4xnYrHfZ9M57N7aBJqU F8Qt15dfwPlREFLhbaPo9xk67bt9rmkPRfHGjNwKtkCdHgAzLP6C7mrKlXCf0S0z+RA2 sbtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=KIxECnYDvGt7qI06FEKCVWmLszPod8JdRctIDVPgFsc=; b=Kaog+r7dEbAHBs4HH9lp8esoQXfPXmT+NCGGMAjBnzoA8bzlRgmYRu2rm/oWLcbnqs IXif+1GNZyqnLFGVoGBFNeZA481wdZsJrKIRciGjihR1u6Y5yuQJFeHRJyVDPM3RWBJt c4bYtf80bD4mCY7Ax89OeOqKmz8hgNTmkJpJhcLOpIawVo8blkJdqdFWveoHQ0g54h4Q tT6vUhzWi1idjaDhsfx/kBrYfdOQhyzhzQAo3alWLqIjqWXUB6m8/M/knIS+A6MrlRM5 vJ2ic5x3nqScW847vURsUhawQCCOBwUG/PTUzGBbm1Y2OkclN5vO1MTRlEuB4oh7GlCH EQMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=rzJle84B; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id sa17-20020a1709076d1100b00741a17b9d20si8095715ejc.536.2022.09.05.00.37.52 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 00:37:52 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=rzJle84B; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 51A343947C3B for <ouuuleilei@gmail.com>; Mon, 5 Sep 2022 07:31:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 51A343947C3B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662363108; bh=KIxECnYDvGt7qI06FEKCVWmLszPod8JdRctIDVPgFsc=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=rzJle84BfUyGwozbfgrNxVJyBjEbjp//ZGUx0PRukFoZFtUGL9pl4+sRt20vEy3Il XW9QkxwuRoUrkv/khxq9O1B47WmrJGNMIFPkh1Wi6RzyqN7axjhVqdML7TQXfOPH9k Y257DtVK/UEpy7irqr+7XYuSaz3Dm2+mZEpOCHr0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 <gcc-patches@gcc.gnu.org>; Mon, 5 Sep 2022 07:26:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C927F3857B98 Received: by mail-wr1-x432.google.com with SMTP id k9so10118478wri.0 for <gcc-patches@gcc.gnu.org>; Mon, 05 Sep 2022 00:26:11 -0700 (PDT) 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-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 To: gcc-patches@gcc.gnu.org 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= <gcc-patches@gcc.gnu.org> Reply-To: Marc =?iso-8859-1?q?Poulhi=E8s?= <poulhies@adacore.com> Cc: Steve Baird <baird@adacore.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1743114440934982868?= X-GMAIL-MSGID: =?utf-8?q?1743114440934982868?= |
Series |
[Ada] Bad Default_Initial_Condition check for a not-default-initialized object
|
|
Commit Message
Marc Poulhiès
Sept. 5, 2022, 7:26 a.m. UTC
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.
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