[COMMITTED,44/51] ada: Fix Scalar_Storage_Order not honored for misaligned wrapped scalar
| Message ID | 20260602084541.3829876-44-poulhies@adacore.com |
|---|---|
| State | Committed |
| Headers |
Return-Path: <gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4BB474BA2E30 for <patchwork@sourceware.org>; Tue, 2 Jun 2026 09:25:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4BB474BA2E30 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=J9p6akvY 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 12D354BA23D3 for <gcc-patches@gcc.gnu.org>; Tue, 2 Jun 2026 08:46:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 12D354BA23D3 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 12D354BA23D3 Authentication-Results: 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=1780389994; cv=none; b=nNMJevpuURtvwWfPx1yXk1wMbjcgCDp0w27QrFthNkbNsVeQFGUWN+OOqVjkqKs4oKDUG0hs5cM1fmaCv8oiizvsZ31zUsMW+2d/B0YlLyj2Wr0iVyBG1aqcMJ1DxiGr6P0FeqETFc+AljOc94M1VikwJIOLWlD4t89Rg1wKcxk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780389994; c=relaxed/simple; bh=vLesSXxgmaivoJrpyv80yQIIvP1su7DxGnCYVl61oks=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=YtKP0JPg7hy/w3AS6TOvrUGKkjI1D7jez2C737jfOi/CFt0G0S0R6W7Aglf4wFScsu1H062PNUaFpFd0+ONhidf+FtJli+rYPoCnmNG+8KLSfFoNAgzE9vV5eadBk4ZbAQrHgPqHGbXmHFq/VMYAm05OJeG28z8uh9GFv4hj1UA= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=J9p6akvY DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 12D354BA23D3 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-490ac357c55so16738915e9.1 for <gcc-patches@gcc.gnu.org>; Tue, 02 Jun 2026 01:46:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1780389993; x=1780994793; 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=FrrJQyP7f8Fkq0we3L6ycnE4RangSxbmRod6AKzCdao=; b=J9p6akvY6kbQa03OqOdO8Plu2E7jF3CdtWdPW6+vO7NsRZnSlfk4uQJTgyFL4w06na LXlLNMalv3Bz+OqTSZjSXtZ7P3FxuTOyCE+jjZJnraXWME1j8dxeAR7+LIqhyf8vQQJO xXi0wyvLq9zT+qYEvpjFVTB3LgnfYF24/3BVeE9WxHGD12JniPaYI9g/K7NGEZbL6E5F yoVD49772ZT5shUTky9aQXIFsadIH2klgawD+6WwoEkinMAS8EEFwxutH/SKb020yA6u inAwX9EP+RaAA54hm+sAw7yY8QCNQD4UNwJHLEr7gaoo4EHSjHyx/RGy1hqdKSeV7aMZ inkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780389993; x=1780994793; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=FrrJQyP7f8Fkq0we3L6ycnE4RangSxbmRod6AKzCdao=; b=m8WR0M/GHyBt6Y7dvJw6fj7tzWGSMidP5pFAXrSzhwee3Jy+idRIMTQXdIOYzhnM73 FtYcq63nWpjiYWjN/pP73pI3O0wcroWBh88jyJRNY8wQBJdmlCfu9F3ZpN1k8lk3hAtk n9S36ZkGI6tTvvrHiXmZFSGEfHkyUp9Y4eF2pwVoWlKnTb432yuBgcgL1pBsnp+kPB0S utkf/RHKgvuxEUwZqU+db1l5dccFKYJJHh7IYW9lWxgP4v+hqoTTsoXSUeYFUkP9mBha 1zTnsr5LS1ov0jA91EFIq/p2IAOd9/odJolA57g4UonT/KBLe88xRLD4Hzwa3iN0/xDW XtPA== X-Gm-Message-State: AOJu0Yzo4mylOp1kTb+VZjYcJYN5FbWXafyJk/g+4r+3xHHimRX1Vg9f /Tlzs0rL+6ViHDdNeGnsENZPPXfTmubVERtObQxXYCRhC37uPXxUfut5dQ7TFvfaJNYqBHNfzhs sr2A= X-Gm-Gg: Acq92OGu6T47F1HQM7d4HmDbp3V6NfrwmwqD+2SA4RJuCvn9fTSUXTz2MCz6zny9F1S S3qdnZ4e5evSWzMzWdcbCyvXfgBp5U3P1bYeZRLcdSQi7n+GMDRPJjkGRRkw0ynOI2fNYNLxK4u tWD70ta5SOWt5hp/fJH0UQ6Jxi783a3bMt75kXX1F4sGn3P1Im4oKcbQUnfVULyaEeQEW6tszD+ 7wElTL2td+fuufKHTrkMpD+W8yh3tL/eAgaGdJr2TF2Xw0v/ql540x1zATlOzbhtMte5+oXT/I6 na3/+/ynWp5cVfK6ghXvhhabLj6Hnfhq4uhuDPXJCGy4tJhTwuOaiY27W+onma5BntU7pw3cE0n 6iyVlPjaJU1r8qpOeRXtg+dB3OK57R6LfXKv/3UXxN10yCDW89lvzTNOUPtwylHN6HknTsgu9sT yJGGyxvMLL9YeVXxqUobMKYS6TxcwP+Vl2psZyq7x/Bs1r1NBDpudK3Lr7b9Osnseza8wI7nr2Q cw3MgvDW32fBWKtMYlHrRK1nDb2F7g= X-Received: by 2002:a05:600c:8508:b0:489:c57:7836 with SMTP id 5b1f17b1804b1-490a2952644mr236925695e9.27.1780389992912; Tue, 02 Jun 2026 01:46:32 -0700 (PDT) Received: from mecano.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490ab55d39csm33907625e9.35.2026.06.02.01.46.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jun 2026 01:46:32 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= <poulhies@adacore.com> To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou <ebotcazou@adacore.com> Subject: [COMMITTED 44/51] ada: Fix Scalar_Storage_Order not honored for misaligned wrapped scalar Date: Tue, 2 Jun 2026 10:45:32 +0200 Message-ID: <20260602084541.3829876-44-poulhies@adacore.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260602084541.3829876-1-poulhies@adacore.com> References: <20260602084541.3829876-1-poulhies@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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_BLOCKED, RCVD_IN_PBL, SPF_HELO_NONE, SPF_PASS, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on 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~patchwork=sourceware.org@gcc.gnu.org |
| Series |
[COMMITTED,01/51] ada: Rename Private_Component function
|
|
Commit Message
Marc Poulhiès
June 2, 2026, 8:45 a.m. UTC
From: Eric Botcazou <ebotcazou@adacore.com>
This occurs when the construct is totally scalarized by the SRA pass.
gcc/ada/ChangeLog:
* gcc-interface/utils.cc (maybe_pad_type): Propagate the flag
TYPE_REVERSE_STORAGE_ORDER from the inner type to the record type
if the former is also an aggregate type.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/gcc-interface/utils.cc | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc index f4fc0cec828..f74b6361b40 100644 --- a/gcc/ada/gcc-interface/utils.cc +++ b/gcc/ada/gcc-interface/utils.cc @@ -1763,6 +1763,16 @@ maybe_pad_type (tree type, tree size, unsigned int align, size_binop (EXACT_DIV_EXPR, TYPE_SIZE (record), bitsize_unit_node)); + /* Propagate the storage order from an aggregate type to the padded type. + Ideally this should not be necessary, because the flag on the padded + type has no semantic effects given that its only field is not scalar. + However, when the aggregate type contains a single scalar field, SRA + may totally scalarize the padded type without taking into account the + intermediate aggregate type and, therefore, may test the flag on the + former instead of the latter to generate a reverse memory access. */ + if (AGGREGATE_TYPE_P (type)) + TYPE_REVERSE_STORAGE_ORDER (record) = TYPE_REVERSE_STORAGE_ORDER (type); + /* If we are changing the alignment and the input type is a record with BLKmode and a small constant size, try to make a form that has an integral mode. This might allow the padding record to also have an