From patchwork Tue Sep 3 08:21:01 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: 1979889 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=Ey3+wk8J; 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 4Wydws1Vmqz1yZ9 for ; Tue, 3 Sep 2024 18:25:31 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2B7D2385EC54 for ; Tue, 3 Sep 2024 08:25:30 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by sourceware.org (Postfix) with ESMTPS id 456CB385EC27 for ; Tue, 3 Sep 2024 08:21:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 456CB385EC27 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 456CB385EC27 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725351683; cv=none; b=urOc7TG+L8Yx9HYvRwEo++kmZh1pEIH9a64aZrbbMC0hYtX/4ld3lXzqDRXMH2YnN8NdH7nGgf9kQEodzoBT+YJVntSvgCC1e0KkJKoNMbWoZ+8Yd1IsCZ/F/iUh8GCffCx5th+k7hu5MFNamH2USgdBsYZQhhdImz2LQ6MeIJA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725351683; c=relaxed/simple; bh=BXBdEJCCUGqHDJxDej6VLHkoSt6kZW1iCSyASBHYnuI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=vfRz2kgljSDhN/Gkj85DH2vj5+guXjaZa2GfPUqoks1cvUSZOG09aw2Zi0IsKh57was0ZVyhcnnpvJlOng2gpiWNgw4UVsJU/ilMKVPgN1QwCx4wHx7V3Q/XMOaDG/HgPxOwTXKyClObj94UYLE2zlU0Ye+4+ah0c6VxUtraYDk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-42c79deb7c4so22212395e9.3 for ; Tue, 03 Sep 2024 01:21:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1725351680; x=1725956480; 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=FZPOros5s1MURE9jgXTTwpwmffzkUKREF9ABO/72I1w=; b=Ey3+wk8J0TXfftUV4BuzRcARPdQadgw4MjIN/AqhvLKbsXJSlUK8WiobyMNaItnLe0 13LUJPu3mFqDgoumMuSqlvxsOTj3rW5ZQivOqG0KPKw3zocjbVqjK2Nv8I2Ok1sg7y7f VTx0Bnu9PYNzWPlDg6NsYZKKqGzhjeUk9gbbfm2kShyn/+T9wp8sSzsioWIFy8BASXlY MEUrGWctM8i0Xte6ectQAUfGYsqaEPXoA9eJiqJMqyZBikDyB+pSRvjKz9GLYU7V650S 3luZXV7oJ30Le3cio+KStn23BvH5txCyDKUrOYvYPaedw6oeVNoM08V9xtHgQWere80H Tbaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725351680; x=1725956480; 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=FZPOros5s1MURE9jgXTTwpwmffzkUKREF9ABO/72I1w=; b=Mns20JtRhVGeyX1dtCPGQuhQpR3om+K094jH6of0Uzp0V5H7Wgj+Jo3mUuuJAxleSA xo7U+3YVOWJedTIBf1UisS5graPAZLj3cu5UodQn2B31uwFSbpApEUtjYPKnA2T2EgBc VHCv2Yf40PUMmfJjxDy6YnYKFN6GadBHVEL+GgjF/KtkpkGL+xEN23BUZAf+Q7QGG2yH YB5GdJXG7NrO6OPqKgEahvq694BM+sPMiLgW6DQOVBFZjdh+pHTegwxW87IgZRxOnbyZ ihoVXzRgZlBqq73+LSWX/xZ5aeYI68tL3eBIMt0I2CLAMP8aCZtL1RioHmCRFQyB9bsx Geog== X-Gm-Message-State: AOJu0Yxpl8oHp3UMsfsCIobZ/v4r05+GUKr2UKw2yN46mYOMEMD9kNle mu+PjSjiybSuqXk/z91nVCTAtIDAQtgQob4DKxY0Lu395ccV6yduLdegt35torIOFWBD7q/iZFA = X-Google-Smtp-Source: AGHT+IHftqKqTM9LGiWm4somaUkNomvdXXUQaSZYf0JE+7faxymMryPCI6HzDa/c7NsQW9fdWbIHug== X-Received: by 2002:a05:600c:3b8f:b0:426:6320:226a with SMTP id 5b1f17b1804b1-42c7b5a8f75mr70534235e9.15.1725351679629; Tue, 03 Sep 2024 01:21:19 -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-42bb6e27467sm162553425e9.38.2024.09.03.01.21.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2024 01:21:19 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 09/10] ada: Plug loophole exposed by previous change Date: Tue, 3 Sep 2024 10:21:01 +0200 Message-ID: <20240903082102.2268026-9-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240903082102.2268026-1-poulhies@adacore.com> References: <20240903082102.2268026-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: Eric Botcazou The change causes more temporaries to be created at call sites for unaligned actual parameters, thus revealing that the machinery does not properly deal with unconstrained nominal subtypes for them. gcc/ada/ * gcc-interface/trans.cc (create_temporary): Deal with types whose size is self-referential by allocating the maximum size. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/trans.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc index caa0f56a34d..fadd6b483d5 100644 --- a/gcc/ada/gcc-interface/trans.cc +++ b/gcc/ada/gcc-interface/trans.cc @@ -4527,6 +4527,9 @@ storage_model_access_required_p (Node_Id gnat_node, Entity_Id *gnat_smo) static tree create_temporary (const char *prefix, tree type) { + if (CONTAINS_PLACEHOLDER_P (TYPE_SIZE (type))) + type = maybe_pad_type (type, max_size (TYPE_SIZE (type), true), 0, + Empty, false, false, true); tree gnu_temp = create_var_decl (create_tmp_var_name (prefix), NULL_TREE, type, NULL_TREE,