From patchwork Thu Jun 13 13:33:36 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: 1947422 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=Oh2f/rUB; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W0NtF3vt5z20Xd for ; Thu, 13 Jun 2024 23:44:05 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AF60E388215F for ; Thu, 13 Jun 2024 13:44:03 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id D1E8A3882644 for ; Thu, 13 Jun 2024 13:34:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D1E8A3882644 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 D1E8A3882644 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::331 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718285668; cv=none; b=rXqGvtPUNg+F05mrDWlPLBN8B2PPRbvxD+gPYXVDqjKb5FD4Is4Q2BODNmElNWF9GN2Dyop6d0Y/KSDXTz7fmukR0BUCPYfiZgUn8qRUyQ6fNzFuH4r4ozrxetspwJnx/h2+4OqzkWavdNCZVLXkVnCxv4GJqUW+ImNTlG6VPd8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718285668; c=relaxed/simple; bh=/NfPSZcFdDBUUIbL20pFvsvxPBVjWYNVW7UGg6sYhjE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=kkXd09T3ibBYd3sySmZil+kq4y/8jZqjP+fC2Q7ujILuZCyrvKxgYKQPCkfdw8iK0atABjM/ACt2pjuEFQL8Fx3HZ08euCzLJHkDvn/rWnssP+488tyzrIOdpX1/OaSrz6tWrpn+mbetGT/ZRNoNjHxjdCFJR6eYAp6Su2eYXqY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-42108856c33so13538885e9.1 for ; Thu, 13 Jun 2024 06:34:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1718285654; x=1718890454; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1WEf+++SlNoF5oBhHBdDssbYDrhxqgQivIzGETlApBA=; b=Oh2f/rUBZ83Ixm939/0KislcTQ4Uq/6SzG/6GID9rGLpkX2jONB4COqyMYejBtF1iv hGGZQHN7FHbTmOXFmprFAk9ilG94speWrDmHK5B/fpbTja7wzuzH2J32v7jvlQHEeqFK n7TWshEkkbJIVXcPo6k1X42oC79d2q+vYxWV7k6koPKNC8lx9SzM9JfuwMJeKakUyFVa Jh0OKRAPu4hx756yL++UNR2mbi7ghpQAeYepV6ramkQsTp+n2NUaTm6AlvW+2cAs9JcF CV9Mai64McSpvGLsBvLecRDu38JlH6tPId7hlKj5EqVEtqjYb63xNsyZkmfBNPP6mNmb Pn+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718285654; x=1718890454; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1WEf+++SlNoF5oBhHBdDssbYDrhxqgQivIzGETlApBA=; b=VKL6s0xvpF09L/Nq/QTaorUYxKVecQKKM4TDFUc2HG64ZK+14wrV47MjPxz8ClqxPy YNFNHZRc7/QUfSz0/UXLZJ5DRNTPqSDjLYvExbNSGCK0Bnz4kIKQQD3X2eQsfpOtkYec LQKJFY+fEsLTjnY+dHIpWze/tZjof94weIK1C3uQbVicRNHJJdj74CFhGLGqOSry/hbO hRmHXJgxiToyjFhGqCxpbzBR37jySEktZOn73BVzluiN08O/czdnG4P/Yxxoo9RgKmVS ykkTf4lzWtzm09ZAqfvlIHOhwV0nQwGoy6HaZ7rgEkGnyUzM5SuA8bfyPTWD0iZou0Re TibA== X-Gm-Message-State: AOJu0Yy42BHAHwojUvMazunqq2K0qBncmgJmnEVYPuLDftrU+lou54FJ k5US3QMCHkDtVxOKgKIiSu94VJglqGcjZvdrtdaQKKXpFLi5bEqtQADPfnKEaXva1YyG3zRH5OM = X-Google-Smtp-Source: AGHT+IFzGCgg7644M+ZGUS9loC2DmePeIiXELeBi6DraNmW2uo5IHHm3t0rsxBmhCsvOgIZNDmBMwQ== X-Received: by 2002:a05:600c:3b04:b0:421:20e3:a25 with SMTP id 5b1f17b1804b1-42304190656mr5240785e9.1.1718285654633; Thu, 13 Jun 2024 06:34:14 -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 5b1f17b1804b1-422870e9145sm62391955e9.22.2024.06.13.06.34.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 06:34:14 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Steve Baird Subject: [COMMITTED 30/30] ada: Compiler goes into loop Date: Thu, 13 Jun 2024 15:33:36 +0200 Message-ID: <20240613133338.1809385-30-poulhies@adacore.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613133338.1809385-1-poulhies@adacore.com> References: <20240613133338.1809385-1-poulhies@adacore.com> 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+incoming=patchwork.ozlabs.org@gcc.gnu.org From: Steve Baird In some cases that are difficult to characterize, the compiler fails an assertion check (if the compiler is built with assertions enabled) or loops forever (if assertions are not enabled). One way this can happen is if Exp_Util.Insert_Actions is called with an N_Itype_Reference node as its first parameter. This, in turn, can happen when an instance of Exp_Attr.Expand_N_Attribute_Reference.Built_And_Insert_Type_Attr_Subp calls Insert_Action (which will call Insert_Actions). gcc/ada/ * exp_util.adb (Insert_Actions): Code was relying on an incorrect assumption that an N_Itype_Reference cannot occur in declaration list or a statement list. Fix the code to handle this case. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_util.adb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 3307f816d15..58ab557a250 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -8101,6 +8101,10 @@ package body Exp_Util is | N_Task_Body | N_Task_Body_Stub + -- Other things that can occur in stmt or decl lists + + | N_Itype_Reference + -- Use clauses can appear in lists of declarations | N_Use_Package_Clause @@ -8370,7 +8374,6 @@ package body Exp_Util is | N_Integer_Literal | N_Iterator_Specification | N_Interpolated_String_Literal - | N_Itype_Reference | N_Label | N_Loop_Parameter_Specification | N_Mod_Clause