Message ID | 20240517083207.130391-11-poulhies@adacore.com |
---|---|
State | New |
Headers | show
Return-Path: <gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org> 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=e5+/r4pJ; 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 4VggJT24jTz20dg for <incoming@patchwork.ozlabs.org>; Fri, 17 May 2024 18:35:21 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 92A413844775 for <incoming@patchwork.ozlabs.org>; Fri, 17 May 2024 08:35:19 +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 74EF7384AB6A for <gcc-patches@gcc.gnu.org>; Fri, 17 May 2024 08:32:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 74EF7384AB6A 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 74EF7384AB6A 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=1715934755; cv=none; b=FlExcecqRCIIdmzbMzmLBltXOyN/qLQfvTYScK1H94U9FEOnXm70X1ArQfChXurXIgbbG8aq1XKiOwIUEbFCIn0faWs3NoWwG7k5dtyUZq/CC5zORr2aUw5zD3Co2auZCrifhXIY3DgZcSZ/nDccuux4xFSfp5Q7Xp3C18jWgkk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715934755; c=relaxed/simple; bh=fFOnhM1RmWMYIH3bbdWayiQZfnvOLW1/QLLnshx5lQY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=h78IlhLDG92AizfQuE57PY82UWALLCsvo6+GVwlA1EYQCbL3DeLa2dSbMdXECZDb0kg5Rc/8wVXo0HybMWPwJaUIuixrNdhpANluj9NPlBZJu3QcXa3045XbU9FjWHJ51KKNZkB2QYFFxqPwNZmtrER7tHmYnH/94utAI0b9gbk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-41fd5dc0439so62786145e9.0 for <gcc-patches@gcc.gnu.org>; Fri, 17 May 2024 01:32:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1715934748; x=1716539548; 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=7S7QpsLlfEI82AUZ7p8hzeZCmwRl/KaHW8Oe8qwuTfU=; b=e5+/r4pJwiB/1SY+d4TVWXO9Geq08WBgFdCy4QchWwtiv/PB42g6zAzwW14XoTa5od MdsoeYN0Jeps93IarCbM3vyV0OHgqJSs+xJiPSUU03gbWKQ4j6ejzNUChf6TfpCmpKnC zf/Nc9EelmW309uAXk4wDocvtUxCa27mqwdEiPMzc0kZswRHv+EerYf/pG3daf1GJ0Yt QmsIlAgfXmL17o5UGKKcvWDhydwn4rI4JB97za5ygj6KRO+c7nX+LKdy2JVAw32gRMVL AxiJcS8BgxNuy9nhgBuzQAtRmuJgUK6NkYCJetKbLuUcQcJNjedx++P3ellcwTnh+cXv kGgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715934748; x=1716539548; 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=7S7QpsLlfEI82AUZ7p8hzeZCmwRl/KaHW8Oe8qwuTfU=; b=vNldgYXScrUWOuOJyhgI2laVjS3ulo9gdUf2nsPj0xxB6zZs6oGKtXT9mo/rIGKQnZ kCFru5Hub8JzowgVIk/zQ50C/wS6G/igDMe2e8A90N2C4HHuIqGIEzrUv7U0r0PKw251 J5W+oNKRTVBreMdXNxsyQu+WCjNSdTtjd6JYMZiHNIWMdI799kNBKrxErELs55H2YPHe vuItWRbXP/oOY9G3vIFVSVAMnmleAGhSk1XuikzKdVCTKRcBXzifHFhcRsW8/E8AV1Me /DfemSSylVVo8eVXh39YKs4wNqCZ7CoI4JFTjhjgTQtxo84V1JrouhK9/7WXvGuCLJTx EeoQ== X-Gm-Message-State: AOJu0YyRdevRV/rMl0xKanEQGEYTl1wzNioNZNx0h/Ixfka2QLD9kjkX bYGr00KPzw5zYqUZgEkkfyiRpRd8y+GMQ36UKGxhbbEbUjwDEqcEkAL41RjE3XXno6Q7MALS5Ws = X-Google-Smtp-Source: AGHT+IEBPuFc1QGP4N9wkNCg7GfnpQqFQkd24f2dyphBSVdaNNtoY5Ojj0J38etW/3zOdaYuAXPdSQ== X-Received: by 2002:a05:600c:a45:b0:416:bc18:2a00 with SMTP id 5b1f17b1804b1-41feac5a4d9mr184753445e9.38.1715934748122; Fri, 17 May 2024 01:32:28 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-420273cff03sm75197045e9.26.2024.05.17.01.32.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 01:32:27 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= <poulhies@adacore.com> To: gcc-patches@gcc.gnu.org Cc: Bob Duff <duff@adacore.com> Subject: [COMMITTED 11/35] ada: Fix Constraint_Error on mutable assignment Date: Fri, 17 May 2024 10:31:43 +0200 Message-ID: <20240517083207.130391-11-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240517083207.130391-1-poulhies@adacore.com> References: <20240517083207.130391-1-poulhies@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.9 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org |
Series |
[COMMITTED,01/35] ada: Add support for 'Object_Size to pragma Compile_Time_{Warning, Error}
|
expand
|
diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb index 525a9f7f0a1..fd521a09bc0 100644 --- a/gcc/ada/sem_disp.adb +++ b/gcc/ada/sem_disp.adb @@ -1514,10 +1514,10 @@ package body Sem_Disp is Subp); else - -- The subprogram body declares a primitive operation. -- We must update its dispatching information here. The -- information is taken from the overridden subprogram. + -- Such a late-overriding body also needs extra formals. -- We must also generate a cross-reference entry because -- references to other primitives were already created -- when type was frozen. @@ -1527,6 +1527,7 @@ package body Sem_Disp is if Present (DTC_Entity (Old_Subp)) then Set_DTC_Entity (Subp, DTC_Entity (Old_Subp)); Set_DT_Position_Value (Subp, DT_Position (Old_Subp)); + Create_Extra_Formals (Subp); if not Restriction_Active (No_Dispatching_Calls) then if Building_Static_DT (Tagged_Type) then
From: Bob Duff <duff@adacore.com> For an assignment statement "X := Y;", where X is a formal parameter of a "late overriding" subprogram (i.e. it has no spec, and the body is overriding), and the subtype of X is an unconstrained record with defaulted discriminants, if the actual parameter passed to X is unconstrained, then X is unconstrained. This patch fixes a bug where X was incorrectly considered constrained, so that if Y's discriminants are different from X, Constraint_Error was raised. The bug was caused by the fact that an extra "constrained" formal parameter was missing in both caller and callee. gcc/ada/ * sem_disp.adb (Check_Dispatching_Operation): Call Create_Extra_Formals, so that the caller will have an extra "constrained" parameter, which will be checked on assignment in the callee, and will be passed in by the caller. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_disp.adb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)