Message ID | 20230706113855.1766024-1-poulhies@adacore.com |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2494035vqx; Thu, 6 Jul 2023 04:40:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlERIPLmKUwNvixlxLA1mUc3CEjb0sSLK3wuEBuYvrBcpvi4Jvb+ViQj1gQMMCC5E9s7oMhC X-Received: by 2002:a17:907:4d0:b0:98e:1deb:caf8 with SMTP id vz16-20020a17090704d000b0098e1debcaf8mr1032254ejb.57.1688643632008; Thu, 06 Jul 2023 04:40:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688643631; cv=none; d=google.com; s=arc-20160816; b=eUxBlA/lpYvxK4HKodSWVgpA2dnVB4LhiqX8U+oYPFyvglJWqhgxmSskepqKYjhsnM gKAPMt6GwbeJU8Xvy6CWlmh4tUPDrfj+AFXNgEqsp3om1ZgeSTS4RXbulunKrFp1bxXX nrI+6JdLUEkWhl8kWkOw636/ssp8NWNIkDVq1SgFLzdTiPJUzgVSGnXSFiyE0IF21a5r xCN6RciuSbaKHW4S3Z3QbGvrswVwXlsbC0ha9rWT2bGXjlS71/hlSXUMqBTlTEn1xOLH Iu5We1A69m2clwf+xvOj1hzZVPcFBAom/XdxsmXszbB5deM/EyvjvGWBfkchqExUdoBf 66PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=m3PJ7ugHNLp+nbTApwMcoeQDLzLwvWMtxyeOJFdq7cc=; fh=qgQjCcgTOS4PqJmTmRtvqfvUI8DwWNjxI7TYi3qv/40=; b=04AEcRwg0+vI3/wTPsuNg1FLCDCWDbqY5bckgwFe8LPze62WcdTdUvJ5Vdg1Vuaqk4 h+lFR4BzO01AN8dSMU131wad+9I2W/cp02FBeyESfZK3nGDyker65B2ZR7etX008AIFz icBQGjSLNi/j6m/ihT2HxomKzonvbMna32dfh8ld8UMLFOBF5H/IQ1qkV0K3VwAV9KuH TsX+/02T2LDTQVkUoDFFqJ7IJWQclxt8PZuQBW4WvPYJvBEbwzDsg/yMawuinUXUlSPJ MRc3Ot8v0IRbP3OfDt8K4lJC70Cm7iVN17ZBxi0hIka2ZqStiheSXi72FGy/1DAJRXKA 4HuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="jIGLdLe/"; 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 (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id rp24-20020a170906d97800b00987fe46fa5asi688818ejb.514.2023.07.06.04.40.31 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jul 2023 04:40:31 -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="jIGLdLe/"; 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 8B71F385E032 for <ouuuleilei@gmail.com>; Thu, 6 Jul 2023 11:39:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8B71F385E032 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688643584; bh=m3PJ7ugHNLp+nbTApwMcoeQDLzLwvWMtxyeOJFdq7cc=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=jIGLdLe/YQ2jgIyp2BXaXrHBzlnwUx3QIpEDvYxWHinJ4gVvZlOBC1WBuXEhAr/B6 L2VN9qw3QCff//GLsYm7WQ2tn4ix18hjUn673j0nXq9Y9vgFzR3r4nGHUYpVsM0CAm 8qQpmnGF4PAco/cS02zCKivpvhu4PNdmnJZ/AiEE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by sourceware.org (Postfix) with ESMTPS id 4E0E93858410 for <gcc-patches@gcc.gnu.org>; Thu, 6 Jul 2023 11:38:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4E0E93858410 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-4fb96e2b573so771189e87.3 for <gcc-patches@gcc.gnu.org>; Thu, 06 Jul 2023 04:38:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688643537; x=1691235537; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=m3PJ7ugHNLp+nbTApwMcoeQDLzLwvWMtxyeOJFdq7cc=; b=j6sL9ocytxQG+sb1dk52B9UxWv993MzBopYuQruuuZUZmyRiCBuPC3uhwZhKr+CBh7 mcm40x3yXC8mZSR9O5TJGaloO0zDm+XwqaDSS0FbKx2zRP/7uBIuhIGs8rxuGWMMMVHR 08mlJ67xO560D70bs11oeNOA1uHPSj0dRYDmWWb2ZRfNTi1bzTgfDLHvGErL/9rTi4xJ z6sO+jTVfDgffNNUSFhkN9RJRa7Us08Ng56pzd0Ucir7IyqORkjh+ZRBnRHj1l2cBlAX BHq735RhiksfYcmYCZXuZU+TpBfKMd96w+DznhiTpqv0TPCeWTp78At6QRpn/l6ez7SG BnSw== X-Gm-Message-State: ABy/qLb6te9zr2wdal/DhnSvAFcUFr3kDyK98+LG1tEwiBzHiD/uEFtJ kuwQF3ohAY+y60hckPhMeF8ZwZrfYQhmxdrk9+JAtA== X-Received: by 2002:a05:6512:220e:b0:4fb:c0d8:10ec with SMTP id h14-20020a056512220e00b004fbc0d810ecmr1635792lfu.1.1688643536555; Thu, 06 Jul 2023 04:38:56 -0700 (PDT) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id z19-20020a7bc7d3000000b003fbe791a0e8sm1911689wmk.0.2023.07.06.04.38.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jul 2023 04:38:55 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Viljar Indus <indus@adacore.com> Subject: [COMMITTED] ada: Avoid crash in Find_Optional_Prim_Op Date: Thu, 6 Jul 2023 13:38:55 +0200 Message-Id: <20230706113855.1766024-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.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: =?utf-8?q?Marc_Poulhi=C3=A8s?= <poulhies@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?1770671184785084210?= X-GMAIL-MSGID: =?utf-8?q?1770671184785084210?= |
Series |
[COMMITTED] ada: Avoid crash in Find_Optional_Prim_Op
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Marc Poulhiès
July 6, 2023, 11:38 a.m. UTC
From: Viljar Indus <indus@adacore.com>
Find_Optional_Prim_Op can crash when the Underlying_Type is Empty.
This can happen when you are dealing with a structure type with a
private part that does not have its Full_View set yet.
gcc/ada/
* exp_util.adb (Find_Optional_Prim_Op): Stop deriving primitive
operation if there is no underlying type to derive it from.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/exp_util.adb | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index c74921e1772..66e1acbf65e 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -6291,6 +6291,11 @@ package body Exp_Util is Typ := Underlying_Type (Typ); + -- We cannot find the operation if there is no full view available. + if Typ = Empty then + return Empty; + end if; + -- Loop through primitive operations Prim := First_Elmt (Primitive_Operations (Typ));