From patchwork Tue Jan 9 13:15:49 2024 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: 186377 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp101787dyi; Tue, 9 Jan 2024 05:21:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IE/RNCdYRwNiZKYSPamjxRigNZBI700kpnvFsfLBgnjmKuRYBzcLcQe4s4GP4cxLrc/apif X-Received: by 2002:a05:622a:1906:b0:429:96f4:4afa with SMTP id w6-20020a05622a190600b0042996f44afamr2581011qtc.101.1704806499693; Tue, 09 Jan 2024 05:21:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704806499; cv=pass; d=google.com; s=arc-20160816; b=vfFSi4W9xH03p3sKdE6QejjD2G8wVg2EsZrd0RSaI2x9hyDqIPPbsYoCEMhD7LIw19 a0AyoUsqaPbNd2ENoSBwbsCS5SjIl9d9jOnKAuv3Yb4ikcC02EMRf+RDncNpZg/ZAjxH oygtqrEw4WznQdX3YxPygUOWK8WNPEB4OhJipZPxwU70P3ak2p5gG45bh2jOf9dW5f4V eK6dliSWhok5eHxqxoim+63y+cKpoFVEkAwZaHlkJ6W7bfaL6cdeZF01l3nFrRASG0/4 gy67pcAFzHc8uBZPYL2Ejekb0PEESHpUNd+1oVmkixOGjIlEfbHQelYsitPMKJzbd0TO b/kw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=5tsu8Sl8BKFhWE+JKbJfizJoILBR4BqbF45kyDzTlbQ=; fh=hOhsC1930eHatDPYd2EALQ9Ry/g++vvN4vxlQkRuX+0=; b=Dwz8Ezr8ZjhTpkWiunKNT/WrizqQ02zC7wsKNVR8wFd+7hbjyN21L5HA9RLfB9lQgA oLPNf2wAEur8uiX93kdeR1cOuNh4n6nXSCaocCZtlARtr2yCCx1cLRW+qYakjfuRdIym VgWx13Xv2qMvmL82mK3TTuCLZM2sVWOQG5+5SZhRCDcv9ho/eEP7Aln1u91pM+3izdFb V8AhfZIn/G+rYm1dbndDgG2GAAwX/w46Cmr1LYixJ44DUapLX3Rf9BD4UDChd1Ai2W2p PlIEfLr982mwUMWzUvNAXIThZBs5wi2QcBmt8nWSDcjfUHEK5/PSm72eB3Fnr2c2nHwu 2QDA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=YUYZwcRK; arc=pass (i=1); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id bp35-20020a05622a1ba300b004277d662d67si2135643qtb.512.2024.01.09.05.21.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 05:21:39 -0800 (PST) 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=@adacore.com header.s=google header.b=YUYZwcRK; arc=pass (i=1); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5F5AA3861821 for ; Tue, 9 Jan 2024 13:21:39 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by sourceware.org (Postfix) with ESMTPS id 42A65386182F for ; Tue, 9 Jan 2024 13:15:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 42A65386182F Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 42A65386182F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::333 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704806154; cv=none; b=mQqd2x4AqNTvzzMFQJ1zN5OlqSCSlK+EQE//kBiP6Nj6mtPjUQ1lfLtVesbPT1gquYVsl5EYT9v6BA8QPxtR4QFSdB7Wnxeb2TeK0gq+AybLgIjn+W8q/wIZyVZJ3uFIVxdZYUyc4UZNIS/qI/UPIGmuxs80gKN/UtNH3bakt+w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704806154; c=relaxed/simple; bh=256GYt6PHMW4pqIoAe6t5AVBEbb0n5Qsp4RjUUhx71Q=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=l6Tox2xB/2A+GWFHXO/4tfO5XX+M001XJUlZuD3/JhKRa1gRex91itri7dh6M2xxqLYOjx1iiygN+1yJN7nJbP3xT46KsMau3tUak6hdJrWMyB3iq1oFL4hCB/uiD74sUZaUzoVFg2IDMBlR2NYZD7jHjNJwQe1pjlnDP6vTMFM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-40e4582ed74so21885375e9.1 for ; Tue, 09 Jan 2024 05:15:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1704806151; x=1705410951; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=5tsu8Sl8BKFhWE+JKbJfizJoILBR4BqbF45kyDzTlbQ=; b=YUYZwcRKgVXNT0StRiFNiwAf8ysBBomkMs5vsP/GEFIg1iyX9jrShH5R7QWqqbEyZ/ zpSapRuvTPVpv2oespZDRclbNVR6xrPmfy+2fVVz8yEO8giLwMn4NFXtavDXIBGboZjo hpiBqpInbvljHopCM4cp8asoSGLvfo/mlYEYQMwzNmBlL7PQSVDv6HSPoyxMXlFVnfG7 xuTuhKqgNXSc7HKKnzSktD5t4YruQJ5tZufQb2VkPFTEO8ke4RotaG5In6X2rO2yLUV2 p2XDzCAjbMLqjxXvxRH03gMFFYz4z7pV3wg5uAZabqI11aGvZmkkKO1LtqafMSKiBhwx ObtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704806151; x=1705410951; 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=5tsu8Sl8BKFhWE+JKbJfizJoILBR4BqbF45kyDzTlbQ=; b=fMqvr/1L315+ZBWsJle3gEF+MlCtPwI6D1+CzYl6/xzgAdFORPZR8Ionv4ZJmdxoXJ nYP0EboiIxX5QPURAcIipWNgHTWZ6Pk3kGs/LgWNHvZEXtLZPe4iHcnioThM1hO6bI5g elhk1vmpj5fOv4YgEuo/uEMn37E/6k4NvhEcqaKKbqWQyV5ZewTs/AETBtW6sBsLNPcl +oCtFbisn8NWUw9t+fB6/iTogj0mo1bWsrjhe2pAK1MJVhVtyU1oRf3JBVdZVbAbNaOR 95Z2SHuWpyf4MMkDDrQU47KzCkhOhfnJxXk9CCMxYw1tvJ9zCa09zLMspQMOFiR4yvQ5 9kng== X-Gm-Message-State: AOJu0Yx/PRvbxXCnsm0VTTMbeR1MDVwvhwXx6SIg4Wwfc0KB4vN5ZSsl B1yVX3H6zzZzl8pQp/g6iVZfuHgOgsjRouBUm0//4FlLsg== X-Received: by 2002:a05:600c:1e0b:b0:40e:4e93:b5c2 with SMTP id ay11-20020a05600c1e0b00b0040e4e93b5c2mr219790wmb.263.1704806151090; Tue, 09 Jan 2024 05:15:51 -0800 (PST) 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 w17-20020a05600c475100b0040d802a7619sm14819441wmo.38.2024.01.09.05.15.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 05:15:50 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED] ada: Fix internal error on class-wide allocator inside if-expression Date: Tue, 9 Jan 2024 14:15:49 +0100 Message-ID: <20240109131549.744564-1-poulhies@adacore.com> X-Mailer: git-send-email 2.43.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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787619180374144132 X-GMAIL-MSGID: 1787619180374144132 From: Eric Botcazou The problem is that the freeze node for the class-wide subtype built for the expression of the allocator escapes from the dependent expression instead of being stored in its list of actions. gcc/ada/ * freeze.adb (Freeze_Expression.Has_Decl_In_List): Deal specifically with itypes that are class-wide subtypes. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/freeze.adb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 26b5589a020..468d6ee6dbe 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -8141,10 +8141,19 @@ package body Freeze is Decl_Node : Node_Id; begin - -- If E is an itype, pretend that it is declared in N + -- If E is an itype, pretend that it is declared in N except for a + -- class-wide subtype with an equivalent type, because this latter + -- type comes with a bona-fide declaration node. if Is_Itype (E) then - Decl_Node := N; + if Ekind (E) = E_Class_Wide_Subtype + and then Present (Equivalent_Type (E)) + then + Decl_Node := Declaration_Node (Equivalent_Type (E)); + else + Decl_Node := N; + end if; + else Decl_Node := Declaration_Node (E); end if;