From patchwork Mon Nov 4 16:10:46 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: 2006304 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=PlaJnfQ9; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; 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 [8.43.85.97]) (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 4XhxQB5WL7z1xwF for ; Tue, 5 Nov 2024 03:15:14 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 99DD53857348 for ; Mon, 4 Nov 2024 16:15:12 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id B6BE73857833 for ; Mon, 4 Nov 2024 16:11:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B6BE73857833 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 B6BE73857833 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::436 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730736713; cv=none; b=P029VVGoU0QRlc35AiKNdLBi3BXHsEJcR4rg/Jxsxu0gUJMGEmggo9/KInaG/lrNALmFqw4iOnbA8mfNEIQ0SmxWdO+f34F3XSahX60Wmh/RkesnBVpNxOFS9pZIS2dL5IndSy5MQIVndSYiGTk1RN0Q6v4Ar5Cch5H6xDvmck4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730736713; c=relaxed/simple; bh=xDqOdrwWcVc1TWmvvXtRGYL36qbhTwkQSMHmV94LYvE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=DizEP6aRf2vvDvQfPTFmGP5IFuPpda9sRCmKfcUEHx7O3wQn7Pd4ymYj0GyqCASnlNISY/3M408wB/VFaYnx9NYFVONix5Qk19PVIrSr2VJQe/lpyDOH9kxGBNpyDSzCdUN8l0aKRcivoZtOmerObAAI2xh4vmvAGcOZ9TM69RI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-37d47eff9acso2825594f8f.3 for ; Mon, 04 Nov 2024 08:11:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1730736694; x=1731341494; 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=dnLVQRg9kLgfwahI4JY5EWtQt5SKfceacNR9j57rNKk=; b=PlaJnfQ9peTKw/+NBCcbGds8HmbivJ0dJ9D6dYPHX4diVrP3tcmtCqGoSyHfKyAfjG JbQCeTNpEJd8XgyunPKYGU48jkjfGPKmHe53AL8vDEahxf5s13o7QiCewMPMw/2rFlFM ZdwohdcGz8KWHrfVC2elMplBzHfAjgHfWA5uXX/vwzFdiIJGFRwRlxw+1dynBVfeyBki +DJNkny8dG1m7Cdqh0KGU2rTMjRxVedzMq6B9GtjVinzaVIkGU1wYMAus5SL+WKiIY9b Z/Xkub+ZW4GpjIl4f1sm4M+vpF/Y9M4S4MnlAopc8ZNjHTTFNK9jgKNkLNnziLUB6E2U GV8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730736694; x=1731341494; 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=dnLVQRg9kLgfwahI4JY5EWtQt5SKfceacNR9j57rNKk=; b=JHHgYEtMszbbHbqN7TGM2UVLjPxeLevIJWZmc/9SuQ//Dcj1vnJ4MqsLRxMIh5cP33 I+X25Nhz52E9xPYsyBRe2hfCud1pmBCe04zOJnc/+ZeVVmhvoxuy2YKAE86lj59iwipX S8WPNOmM7LzNFfq8/xVlLcwCR8WjcIQC85+BZsvy8pYniSqVFejo4BYSUZ4bnax9ybtX KBkpYARIwNFRzVpHZwn5+BfZvru1EBWaDAa/smQ/qCrxUUQl2rJfh05I7H48rj43uZRd A48mwUaGuVM34Az83wms6KFgOoZcnLviPz4LlofiOo/SEuD4gTsR58UQ5qJ1Z8T/E1Jg pNcQ== X-Gm-Message-State: AOJu0YzSJB/UNGlJyv7uV7mtBEA2drL3Jpm208S7nh/L0prt3Xu5UvpJ swo1OYBwpLcor3eKumunNtuQ3JSRUQVcPFSiG81K75FOuvdZcI9XJZm6oorQ/HPn8FnQvF2JVqQ = X-Google-Smtp-Source: AGHT+IH/UzqMFXURaPTJBLDim+9Z15cZkspb+3EaEdZTNv/NRMtyCuBL6lEvoqA+tTIHvqQjBUTMCg== X-Received: by 2002:a5d:6c63:0:b0:37d:3973:cb8d with SMTP id ffacd0b85a97d-381c7a5e9d5mr9935152f8f.24.1730736694356; Mon, 04 Nov 2024 08:11:34 -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 ffacd0b85a97d-381c10e747csm13574463f8f.64.2024.11.04.08.11.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 08:11:33 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 11/38] ada: Fix internal error on alignment clause for type declared in generic unit Date: Mon, 4 Nov 2024 17:10:46 +0100 Message-ID: <20241104161116.1431659-11-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241104161116.1431659-1-poulhies@adacore.com> References: <20241104161116.1431659-1-poulhies@adacore.com> MIME-Version: 1.0 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 The front-end raises Program_Error on an alignment clause for a type in a generic unit that references the alignment of another type in the unit. gcc/ada/ChangeLog: PR ada/117051 * freeze.adb (Freeze_Entity): Call the layout procedure on subtypes declared in a generic unit when they are static. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/freeze.adb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index c7e3be028a7..9a862176c30 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -8022,9 +8022,11 @@ package body Freeze is -- generation, and so the size and alignment values for such types -- are irrelevant. Ditto for types declared within a generic unit, -- which may have components that depend on generic parameters, and - -- that will be recreated in an instance. + -- that will be recreated in an instance, except for static subtypes + -- because they may be referenced in the static expressions of the + -- generic unit, which need to be evaluated during its processing. - if Inside_A_Generic then + if Inside_A_Generic and then not Is_Static_Subtype (E) then null; -- Otherwise we call the layout procedure