From patchwork Fri Jun 21 08:58:18 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: 1950663 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=fpIUft/z; 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 4W5BL80Zvwz20X6 for ; Fri, 21 Jun 2024 19:06:24 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 58BDB3896C3F for ; Fri, 21 Jun 2024 09:06:22 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id B8DDC3895FE3 for ; Fri, 21 Jun 2024 08:58:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B8DDC3895FE3 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 B8DDC3895FE3 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::329 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718960331; cv=none; b=woN52eBapMVU+CAkGKKRtQMMXMnVgSHWUgjPjnb7Qy0Efs2At9TuD+rr8tmCLxTJKqEw1TBBmENwWHy37k8icLlohOiZUqbzKVm1DtPkDGxGlSJQS2DHHEkoahTsN/Y9FutRme0W06xhLUigZcInFDMnRNTdLCpfvv/nBIL5ACI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718960331; c=relaxed/simple; bh=wLNjwS4nT6BG5xIaFGjLIXfB2m1kqRogAxeYXJRGRO0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=hbef+nE+b6w0CjHQ0IPlYKjvMPe2V49vj5zf7x8zzZw0DTwXGnC7Hhk+djEQyygpEma0B8cda3GfSVs6O6Foy/n9HSk/Fw7y2RLuibjpXaqG9I4S3DtPoYCBqNCUvz0sokrpCgmDwZtzzU4nnpVXJr+lh47F5U8M7y0riveQao8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4218008c613so15927495e9.2 for ; Fri, 21 Jun 2024 01:58:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1718960327; x=1719565127; 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=e7r//xljxR/1Dv4Tt74QBDvIUnN6lzeiUihCNaKxVIQ=; b=fpIUft/z1GFrHp0UnUp5s5LVeFk96wufmig47Cm5onQGSM+hs/9qzvKiPHIpSF7QxT SrfLv7ayOTmYXBRM1vptXloT17hOD+k0AYyKq3x6UskxiOUwUvVHWts5f5IPogPAEIzw sI8+DnvuEqSHQ3FAuKeFd87/G+ZYk+LBAWonLi3YQV4NvkKUnkVeIINc8Wh3HZHpTKfQ 2sdMdtt81TUb/u6Qn45tFTKN6DkikdFT3E/P8XU6iw7BGk64Yx71DBYn6zziSEokE4W2 Gg12sMFuUVdL3UUo43E37IOMX0ggK1zuRxzcJXkoBkWMXB5pxJhg6zmX4gBWVUnfIfXQ kDFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718960327; x=1719565127; 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=e7r//xljxR/1Dv4Tt74QBDvIUnN6lzeiUihCNaKxVIQ=; b=Bf91EB+O7HJYQe8D5KEG1AtZkDM3Ynte5OUkLz1YiGH+Hp9g02buxGF1nQkLS0LjCs Hq3YuP47MZDVD1XnDSjJBN2L9xUh57yHeF0fkCA7NH1USYVUN32JzhUgofu1oNcmR8xf mVLXDXnPtkEtx0XxKvXWZNw5ZF3CO8imSbSmnE8/dAkVj4nBDDUH0rPBT++oZ+6YRrS3 yPWb9OivWZdkqfpzJVtHe8SVN95UEN1nERoYeRJ5CKvLe1QCqhDjFr7N4G5m01Z5+CzK uL5Of4dqzSV7MVYt2VUdAStNC6XV34AhM2qcR9u7DMoiX8Q510yjNPLZ8EbT96QRH0S0 dPqQ== X-Gm-Message-State: AOJu0YzLoFM8n7HdOUYEMC1hynn2PE06olHRlhWCRIFrBWpKEWKPrjpL t6QXRUULl3wFBWAe2gXWyR6CqPOCnOdi6gGddMUx5ZTqSSuGHx2mMu2JTZ0YdXLc9tv7M890Mjw = X-Google-Smtp-Source: AGHT+IH2TpNCCiOdA8FjvUL0QQviDmuSQzH53hBsMHhtOBuSvT8jkkHImyMSq4tDUGKAyeZajUAchQ== X-Received: by 2002:a05:600c:1792:b0:421:75e2:c090 with SMTP id 5b1f17b1804b1-42475176435mr62220585e9.11.1718960327515; Fri, 21 Jun 2024 01:58:47 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:a589:2704:bfe1:5d92]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4247d0c5485sm55322375e9.21.2024.06.21.01.58.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jun 2024 01:58:47 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 22/22] ada: Fix internal error on protected type with -gnatc -gnatR Date: Fri, 21 Jun 2024 10:58:18 +0200 Message-ID: <20240621085819.2485987-22-poulhies@adacore.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621085819.2485987-1-poulhies@adacore.com> References: <20240621085819.2485987-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 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 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: Eric Botcazou It occurs when the body of a protected subprogram is processed, because the references to the components of the type have not been properly expanded. gcc/ada/ * gcc-interface/trans.cc (Subprogram_Body_to_gnu): Also return early for a protected subprogram in -gnatc mode. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/trans.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc index 83ed17bff84..3f2eadd7b2b 100644 --- a/gcc/ada/gcc-interface/trans.cc +++ b/gcc/ada/gcc-interface/trans.cc @@ -3934,6 +3934,12 @@ Subprogram_Body_to_gnu (Node_Id gnat_node) if (Is_Generic_Subprogram (gnat_subprog) || Is_Eliminated (gnat_subprog)) return; + /* Likewise if this is a protected subprogram and we are only annotating + types, as the required expansion of references did not take place. */ + if (Convention (gnat_subprog) == Convention_Protected + && type_annotate_only) + return; + /* If this subprogram acts as its own spec, define it. Otherwise, just get the already-elaborated tree node. However, if this subprogram had its elaboration deferred, we will already have made a tree node for it. So