Message ID | 20220713100251.GA994589@adacore.com |
---|---|
State | New, archived |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a98:d5ce:0:b0:178:cc93:bf7d with SMTP id g14csp164245eik; Wed, 13 Jul 2022 03:06:56 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vxCdwcWGubKTXkG2pJ0oR4xn3mRxWtyg43duRK6f43RaSrdmF5bYhB2v61Y8aH2lDX/Wps X-Received: by 2002:a17:907:7f94:b0:72b:47da:4bf3 with SMTP id qk20-20020a1709077f9400b0072b47da4bf3mr2613674ejc.157.1657706816717; Wed, 13 Jul 2022 03:06:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657706816; cv=none; d=google.com; s=arc-20160816; b=xLxnbVgpNy1PE+AiEhnDcvAXb9tCf7ZouWly688E2knW4l2kcJK346CMfe+nBICQGM e9XRw1dBdXjpl6w+0EZ+pgzuiTEBO9aURi7qyf89wpAYhYGzvZYlNsxK0Yvht5zp9SEP Pgcg29huRv7+nzgh8SioEcTmN757pJZSnd7Ai06PbH4EHHWCct3D4YhMb4LWArjgeJB4 kQnGDmeIESfV6ExK0oAgSpZuyIAzvok8NKiYsIsyWoQiSlH2/70JRNWwNHlLQnCiwq4p 3ns+oKb1p0gloe6LXO2Q47+UDtzwKoHi0In0MO9mx9HFaaHs/UxAlzNEVhTYpnckbtQf 9i5A== 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=jCBGlAAbKkxzH9i+ZiA2ky9PC3F15hI7eRtracS0QAE=; b=vHk6Fkdq3Yizo07PXtQAYgZqx+MA+qlFwl6YoLMSLpdclUcz7L2vOpwJlu9te/uwnU O5lVN+YIoYeIlyr4UkrMXpCD+lLAi2xcLtn7q4+u80ruW8ZCWA4ti1JdNaOs15yg2fW8 M+ltwXeY7J2wfC3SuEnuiaswrSf+y/LWAD0WGlPLfbaPWtjITcpWj5QDw5Ox8qrA74De 2jR8UEh0VsQ1JjUe008Tcvrpf9UGc09FdrcJmX4FMnrRQdQL/BarZuuWw9afVHx1gJ/Y iVuTMKXcrLJ4QJTJcJG/JH+gJ4AtuLnCGwM2W+hg0EqIrCkblCll6vD8BkklVxzIkcS2 pkFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=tYDqnIOD; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id x2-20020a170906134200b007070522a0fdsi15726238ejb.835.2022.07.13.03.06.56 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 03:06:56 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=tYDqnIOD; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 F26C638245B5 for <ouuuleilei@gmail.com>; Wed, 13 Jul 2022 10:04:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F26C638245B5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1657706678; bh=jCBGlAAbKkxzH9i+ZiA2ky9PC3F15hI7eRtracS0QAE=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=tYDqnIODkwDgDQ4G5Qs4QC5ePSTXOQiFl+qCjM81eIQXcHtbUorFDYME8Vf0nJZ37 +4gWPOo6bDbmq0TspRuHuw/yEmxjuK5zndF/akB0iHq+SF6lnWT5dlaQOyFBlgVVic TqOjoBrQEASe6WTdLc21TN2lpox8ye1m++UrqeGI= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by sourceware.org (Postfix) with ESMTPS id 37CAC38515C9 for <gcc-patches@gcc.gnu.org>; Wed, 13 Jul 2022 10:02:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 37CAC38515C9 Received: by mail-ed1-x534.google.com with SMTP id e15so13425476edj.2 for <gcc-patches@gcc.gnu.org>; Wed, 13 Jul 2022 03:02:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=jCBGlAAbKkxzH9i+ZiA2ky9PC3F15hI7eRtracS0QAE=; b=DJIi3iEJoV21tI4AUMIo5TRO0C1u2gV1FHg4SwrLKZG1lqeyhXW6d6BViSoxy9xU6m 7L30eE4piFYHSqKxb97fQxFqwwHVMLHNV79IobgXwPQemXdyBBt1PGXAIksNy8pHhCng 1Q7+1Fz3uXt4G30mFnuHF0BX7EFv2n/KZKTtQyFbwiKoxdFNqVcOSGqArXLcgkHCQFUb ilOCcAywF+nCpCasSfU1CDC4zHxOpRtMz1BrNm5PdKPEo43d3LveLrzbhxpBN1+O5ano Tt9TiQDU9fobblj89HHEZmDQ4/VmZ/03TnzSygiBM/Kun0fJCm5YVrJNDs/hPrxHKoh/ RHdg== X-Gm-Message-State: AJIora9DfZmfpjC0XL5WSodmGXVyc/uxSozrGusMqjUcOBWPHpaEB4vt rPHHFAvHNqGnTe+UNRmWfl3GjnOb+a4aRg== X-Received: by 2002:a05:6402:4244:b0:43a:ded8:563b with SMTP id g4-20020a056402424400b0043aded8563bmr3878351edb.222.1657706572042; Wed, 13 Jul 2022 03:02:52 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id j21-20020a170906255500b006feb479fcb4sm4793818ejb.44.2022.07.13.03.02.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 03:02:51 -0700 (PDT) Date: Wed, 13 Jul 2022 10:02:51 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix crash on frontend inlining of functions with single returns Message-ID: <20220713100251.GA994589@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="vtzGhvizbBRQ85DL" Content-Disposition: inline X-Spam-Status: No, score=-13.2 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: Pierre-Marie de Rodat via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Pierre-Marie de Rodat <derodat@adacore.com> Cc: Piotr Trojanek <trojanek@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?1738231583023792669?= X-GMAIL-MSGID: =?utf-8?q?1738231583023792669?= |
Series |
[Ada] Fix crash on frontend inlining of functions with single returns
|
|
Commit Message
Pierre-Marie de Rodat
July 13, 2022, 10:02 a.m. UTC
When examining expression of the first declaration of the inlined body make sure that this declaration is in fact an object declaration. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * inline.adb (Has_Single_Return): Add guard for the subsequent call to Expression.
diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb --- a/gcc/ada/inline.adb +++ b/gcc/ada/inline.adb @@ -4648,6 +4648,7 @@ package body Inline is return Present (Declarations (N)) and then Present (First (Declarations (N))) + and then Nkind (First (Declarations (N))) = N_Object_Declaration and then Entity (Expression (Return_Statement)) = Defining_Identifier (First (Declarations (N))); end if;