From patchwork Tue Jul 18 13:13:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 122011 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp1737199vqt; Tue, 18 Jul 2023 06:15:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlGsg7LZ/jgk8Aa+aWNQQtKr4XLbDJVd69yi4GOlJeVwWhSlTFFS+ZTbc/ncyzrGOEJ9O+Si X-Received: by 2002:a05:6402:744:b0:50b:c693:70af with SMTP id p4-20020a056402074400b0050bc69370afmr12921664edy.2.1689686139681; Tue, 18 Jul 2023 06:15:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689686139; cv=none; d=google.com; s=arc-20160816; b=c5IunSyhExrhNOf/DuBHwIQr6i0eKLeoiVgT5PfKGoQ4Vi8wItnRDfrE2IUQlml4cQ CADY+4V3u6eotgGCBK5B6UKfN6fRgkfsHyYUQMCYRRJP3zggv8wTNIQ1Deg08Z4iwe8e pVLpTlXoUaGI33ak3Dn5QR3az0PVP1ivECJV3uVhjrL6KkDduowPWqEnhhV5Quuz5REv 7uAJvbEHrR95F/4cDt+AHsjYJqFGy2VYqGdll0buVSH7i0i6n0Hl/5upCecJQjEYchMY yK30jzpgmZV2ojY1M4gDeUzfxPs72Fgnbdj85yRbY3wA40Nw48AbLfdYmtaomly89ZuY AXdw== 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=4bh2lKw3o0FrY4EaW+XYXapAcNUgAnm45SyeAvsxcHM=; fh=/3KX5nH+f3PGIzCwnuf//1E+cbLgxv/xavy4NboKqC4=; b=m/RsA8zjZ+P0KvFbDITFBQ5AV8r84rsX3LfzMBWZj2RNYL1QYWw0wLZYD53sIr9pXz 9H1qk+Al2oCm49VwjbBuvu809ACbfT6xkdyfyZ3+aiOce6iwt8u4az03rlo6StsWPR9U /wK166QofaLH3EAryz1uPeToduwj9r2YPNcuk8JpMVH678hbxM0NqrPo53+uzw2gwpLv 2AXdTfhZ+mRS1qPR5wfmZ+Oa9BAy2+otc04WF19TR4N5ittHq3UjobVlo4DzloQwRcEO MeebqS+m7qgaBQYCRAUInouYNDYU4StJRDUAbse7dahWe52iPWrCRl6DuU4sdebj/99T uFeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=oKqPmtEN; 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 (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id o21-20020aa7d3d5000000b0051dddbd08basi1193923edr.352.2023.07.18.06.15.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jul 2023 06:15:39 -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=oKqPmtEN; 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 7821638708F5 for ; Tue, 18 Jul 2023 13:14:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7821638708F5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689686060; bh=4bh2lKw3o0FrY4EaW+XYXapAcNUgAnm45SyeAvsxcHM=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=oKqPmtENjrsRUd5RARxRCUUMcx19SeuOmJ/nicdwShWrG4TyAqpkl79q4iRzSZDCd I/Cqi28Hn4JJaadRi8u+MAAHg5jSYS8tCmZ9pbRQ2QNmBBlQxaDbqdOtRvGg7IoCZc u1SnDvFJ19ImoTrs9K70oLIOz7FGPBrjHEuEIXns= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by sourceware.org (Postfix) with ESMTPS id 6AD77385AF85 for ; Tue, 18 Jul 2023 13:13:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6AD77385AF85 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-4fc8049fd8bso9043336e87.2 for ; Tue, 18 Jul 2023 06:13:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689686011; x=1690290811; 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=4bh2lKw3o0FrY4EaW+XYXapAcNUgAnm45SyeAvsxcHM=; b=FWm3R2H1+C92sRyf8zjNelhaE5qKntfhWQnOM142nX5NCtlQotv0DeJSTwxmLFM/D3 mYUZRNzQOXSo/cPYV7VybgJC+vozUZYjYdrsmSYUj/KLh569ZuGG7i9rSMl3Lyz3FliV pjlp1Z7cMZGmHnZkCqHYVbrM+q6RDIH2Eu2LwBv5Bx3M14YnsJoFmixHVJbAUqzEQalz XphJhyruHnEwcFuZ9sQy/cCcMRI9+JoyrY8Dz6i8juQdq1GUI5dRtCvvslHAKyMqFBcs l3LvLC77tAAcTAeHDvShA0RB++MWsUUSnx/OboaoIP1Mkx+EMYJ8XUy3+T6ARBj2gBIX U/jg== X-Gm-Message-State: ABy/qLYiMfHZl0u/hgs3KkFPwWAIdkuBTEEi/AjdzXEgOBCGB+VEQDB9 wF1IFEjdWBb/0PMI5eMEZB6eIcyBs9xxtb2vkpw8Lw== X-Received: by 2002:a19:ca52:0:b0:4f8:6d54:72fb with SMTP id h18-20020a19ca52000000b004f86d5472fbmr8803339lfj.62.1689686011008; Tue, 18 Jul 2023 06:13:31 -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 i1-20020a05600c290100b003fbfa6066acsm2079643wmd.40.2023.07.18.06.13.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jul 2023 06:13:30 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED] ada: Fix assertion failure introduced by latest change Date: Tue, 18 Jul 2023 15:13:29 +0200 Message-Id: <20230718131329.81009-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: =?utf-8?q?Marc_Poulhi=C3=A8s?= Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771764333421924515 X-GMAIL-MSGID: 1771764333421924515 From: Eric Botcazou The new processing is not properly guarded. gcc/ada/ * sem_ch13.adb (Replace_Type_References_Generic.Visible_Component): In the case of private discriminated types, explicitly check that we have a private declaration before examining its discriminant part. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch13.adb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 4f97094aae5..585c0f33d8b 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -15593,8 +15593,6 @@ package body Sem_Ch13 is elsif Is_Private_Type (T) and then Has_Discriminants (T) then declare Decl : constant Node_Id := Declaration_Node (T); - Spec : constant List_Id := - Discriminant_Specifications (Original_Node (Decl)); Discr : Node_Id; @@ -15604,8 +15602,11 @@ package body Sem_Ch13 is -- name; then, if it exists, return the discriminant entity of -- the same name in the type, which is that of its full view. - if Present (Spec) then - Discr := First (Spec); + if Nkind (Decl) in N_Private_Extension_Declaration + | N_Private_Type_Declaration + and then Present (Discriminant_Specifications (Decl)) + then + Discr := First (Discriminant_Specifications (Decl)); while Present (Discr) loop if Chars (Defining_Identifier (Discr)) = Comp then