Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2216867/?format=api
{ "id": 2216867, "url": "http://patchwork.ozlabs.org/api/patches/2216867/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260327111422.C514D4A0A2@imap1.dmz-prg2.suse.org/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/projects/17/?format=api", "name": "GNU Compiler Collection", "link_name": "gcc", "list_id": "gcc-patches.gcc.gnu.org", "list_email": "gcc-patches@gcc.gnu.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260327111422.C514D4A0A2@imap1.dmz-prg2.suse.org>", "list_archive_url": null, "date": "2026-03-27T11:14:14", "name": "middle-end/120839 - use unaligned incoming stack argument copy more", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "68d588a24958108ccd2330fdec589defa1952ebe", "submitter": { "id": 4338, "url": "http://patchwork.ozlabs.org/api/people/4338/?format=api", "name": "Richard Biener", "email": "rguenther@suse.de" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260327111422.C514D4A0A2@imap1.dmz-prg2.suse.org/mbox/", "series": [ { "id": 497749, "url": "http://patchwork.ozlabs.org/api/series/497749/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=497749", "date": "2026-03-27T11:14:14", "name": "middle-end/120839 - use unaligned incoming stack argument copy more", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/497749/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2216867/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2216867/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256\n header.s=susede2_rsa header.b=ULN930lQ;\n\tdkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=VWgcdRUS;\n\tdkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de\n header.a=rsa-sha256 header.s=susede2_rsa header.b=OGmgZcis;\n\tdkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=4FG84Zct;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)", "sourceware.org;\n\tdkim=pass (1024-bit key,\n unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256\n header.s=susede2_rsa header.b=ULN930lQ;\n\tdkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=VWgcdRUS;\n\tdkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de\n header.a=rsa-sha256 header.s=susede2_rsa header.b=OGmgZcis;\n\tdkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=4FG84Zct", "sourceware.org;\n dmarc=pass (p=none dis=none) header.from=suse.de", "sourceware.org; spf=pass smtp.mailfrom=suse.de", "server2.sourceware.org;\n arc=none smtp.remote-ip=195.135.223.130", "smtp-out1.suse.de;\n dkim=pass header.d=suse.de header.s=susede2_rsa header.b=OGmgZcis;\n dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=4FG84Zct" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fhyjG4Bfyz1y1j\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 22:14:58 +1100 (AEDT)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 10BFF4BA2E20\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 11:14:56 +0000 (GMT)", "from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130])\n by sourceware.org (Postfix) with ESMTPS id EE5784BA540B\n for <gcc-patches@gcc.gnu.org>; Fri, 27 Mar 2026 11:14:24 +0000 (GMT)", "from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org\n [IPv6:2a07:de40:b281:104:10:150:64:97])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by smtp-out1.suse.de (Postfix) with ESMTPS id EED7421EE4;\n Fri, 27 Mar 2026 11:14:22 +0000 (UTC)", "from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C514D4A0A2;\n Fri, 27 Mar 2026 11:14:22 +0000 (UTC)", "from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])\n by imap1.dmz-prg2.suse.org with ESMTPSA id jAx5Lo5mxmlXCwAAD6G6ig\n (envelope-from <rguenther@suse.de>); Fri, 27 Mar 2026 11:14:22 +0000" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 10BFF4BA2E20", "OpenDKIM Filter v2.11.0 sourceware.org EE5784BA540B" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org EE5784BA540B", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org EE5784BA540B", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1774610065; cv=none;\n b=dIz/Dw6dcVFvfkuldTXhxsBBIs2CH0FR+DU8bQRZHJGj0GbxFtkLj8SjbDiPcaAAyBJso/tW9wIo3i8gShUfoq0/WhT9P14yCeW24C+DiwoFCJOTOBPIeJlJFN/fKpq/qVI/BmReXo2MzTX6jN7bliWDkpzGC8PE+YW1VxQBg84=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1774610065; c=relaxed/simple;\n bh=X5pb98y1rSmwOj+IUI8DmnuEmVtRzeFh3/gYduhHd/o=;\n h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date:\n From:To:Subject:MIME-Version:Message-Id;\n b=eWOVgtk6f8osTI5uM0KpwseiF+qnZlrLEHB1FoYgBVzjW6NZ5PMVYmuN/wh8m7bFmvtKr1oCHwAA0J1x8sNlyBzzzprpJHnoQqOfrSUqZ2PcbqI7R3As5f14IwRPWGGDRdB6UCHkKRW4lTbyLSHlKaqGMn7e3YXRYfjqGBegwI8=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1774610064;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type;\n bh=srkdSD0W0GQuApkzTzaaqhhFt8/kjducSrVifsLeEGs=;\n b=ULN930lQ1ZzzDX+nthzOJZumV45HwADTtPsQJ1bMbmJmWuxQ7daRKIkUib8ZXliuuUZzgL\n 3LR1V5hl571JZ2RF81OSezBpv5tnJ6TB3zYkns/mU7eTLhtsjIcfKKBkcGCTa6VL+mnrS1\n 3dZZB6qUCCxzV+wXWkT0SI6iIveQfwg=", "v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1774610064;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type;\n bh=srkdSD0W0GQuApkzTzaaqhhFt8/kjducSrVifsLeEGs=;\n b=VWgcdRUSlmI/UKAbnhZVtExKeFSe6RuIY5NHIKCUr/DrYNKS4cJrd+ZmfNbfQdOcXRZY4g\n PM8J9S4IoVxnGsAg==", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1774610062;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type;\n bh=srkdSD0W0GQuApkzTzaaqhhFt8/kjducSrVifsLeEGs=;\n b=OGmgZcisoMdGxIu3zott+vkevRWPsmmL76cg0GVQi70M/J8x3qY6IrpbA3kA8fISmX/imy\n vKCuDeGhRuYbopjfZPLHyNJVk3lQnf7SyED9gbCAty0EVUhOhYerU5pXrnXhTXJObmrdbF\n dPQOnKcHNsDe/50YXBaf5ZDk7iMsDkg=", "v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1774610062;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type;\n bh=srkdSD0W0GQuApkzTzaaqhhFt8/kjducSrVifsLeEGs=;\n b=4FG84Zctl6vbJTr+FjVQnSwuVaBksZevFWvjmr5T3ML296ovrqx4PXc1uuAvMjBZSbydzm\n rgJtz7FMnd0VPXDg==" ], "Date": "Fri, 27 Mar 2026 12:14:14 +0100 (CET)", "From": "Richard Biener <rguenther@suse.de>", "To": "gcc-patches@gcc.gnu.org", "cc": "rdsandiford@googlemail.com, hjl.tools@gmail.com, ubizjak@gmail.com", "Subject": "[PATCH] middle-end/120839 - use unaligned incoming stack argument\n copy more", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=US-ASCII", "Message-Id": "<20260327111422.C514D4A0A2@imap1.dmz-prg2.suse.org>", "X-Spamd-Result": "default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%];\n NEURAL_HAM_LONG(-1.00)[-1.000];\n NEURAL_HAM_SHORT(-0.20)[-1.000];\n R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];\n MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[];\n TO_MATCH_ENVRCPT_ALL(0.00)[];\n FREEMAIL_ENVRCPT(0.00)[gmail.com];\n DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];\n FUZZY_RATELIMITED(0.00)[rspamd.com]; MIME_TRACE(0.00)[0:+];\n FREEMAIL_CC(0.00)[googlemail.com,gmail.com]; ARC_NA(0.00)[];\n RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from];\n RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+];\n RCPT_COUNT_THREE(0.00)[4]; RCVD_COUNT_TWO(0.00)[2];\n FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[];\n SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from];\n TO_DN_NONE(0.00)[]; TAGGED_RCPT(0.00)[];\n RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received];\n MISSING_XM_UA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[];\n DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim, imap1.dmz-prg2.suse.org:rdns,\n imap1.dmz-prg2.suse.org:mid, imap1.dmz-prg2.suse.org:helo]", "X-Rspamd-Action": "no action", "X-Rspamd-Server": "rspamd1.dmz-prg2.suse.org", "X-Rspamd-Queue-Id": "EED7421EE4", "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>,\n <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>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>", "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org" }, "content": "The following fixes a confusion seen in the x86 backend by\nassign_parm_adjust_stack_rtl failing to trigger a local stack copy\nfor an incoming stack parameter that is not aligned according to\nits type. The condition was introduced in r0-64961-gbfc45551d5ace4\nbut there is the MEM_ALIGN (stack_parm) < PREFERRED_STACK_BOUNDARY\ncondition not triggering for the case in question where both\nMEM_ALIGN and PREFERRED_STACK_BOUNDARY are 128. x86 supports\nstack-realignment so we can honor the declared alignment and this\nclears up the confusion. The following replaces the bound\nby MAX_SUPPORTED_STACK_ALIGNMENT if SUPPORTS_STACK_ALIGNMENT\nand the parameter has it's address taken and with BIGGEST_ALIGNMENT\nif SUPPORTS_STACK_ALIGNMENT otherwise, only affecting x86 and nvptx\nat this point.\n\nIn addition to this it changes the i386 backends computation of\nthe maximum stack alignment used to bound itself to BIGGEST_ALIGNMENT\nbecause the middle-end does not (and in general cannot) enforce actual\nalignment of all stack objects according to their type.\n\nBootstrapped and tested on x86_64-unknown-linux-gnu.\n\nCompared to v2 this uses BIGGEST_ALIGNMENT if the parameter does not\nhave its address taken and caps ix86_update_stack_alignment on\nBIGGEST_ALIGNMENT as well.\n\nOK for the x86 parts? I assume the refined function.cc hunk is still\nLGTM from Richard S. side.\n\nNote I still fail to see why we need to scan all insns in the backend\nagain after RTL expansion should have ensured to keep track of the\nmaximum needed stack alignment. But I'm trying to avoid touching\ncode I do not understand as much as possible.\n\nThanks,\nRichard.\n\n\tPR middle-end/120839\n\t* function.cc (assign_parm_adjust_stack_rtl): Get the parameter\n\tas arugment. Adjust alignment check forcing a local copy for\n\tSUPPORTS_STACK_ALIGNMENT targets if the argument is not aligned\n\tto its type and the current alignment is less than\n\tMAX_SUPPORTED_STACK_ALIGNMENT if the parameter has its address\n\ttaken or BIGGEST_ALIGNMENT otherwise.\n\t(assign_parms): Adjust.\n\t* config/i386/i386.cc (ix86_update_stack_alignment): Bound\n\trecorded stack alignment requirement by BIGGEST_ALIGNMENT.\n\n\t* gcc.dg/torture/pr120839.c: New testcase.\n\t* gcc.target/i386/pr120839-avx.c: Likewise.\n---\n gcc/config/i386/i386.cc | 2 +-\n gcc/function.cc | 14 +++++++++++---\n gcc/testsuite/gcc.dg/torture/pr120839.c | 7 +++++++\n gcc/testsuite/gcc.target/i386/pr120839-avx.c | 8 ++++++++\n 4 files changed, 27 insertions(+), 4 deletions(-)\n create mode 100644 gcc/testsuite/gcc.dg/torture/pr120839.c\n create mode 100644 gcc/testsuite/gcc.target/i386/pr120839-avx.c", "diff": "diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc\nindex 15e0dd547a9..f2a49bbaf46 100644\n--- a/gcc/config/i386/i386.cc\n+++ b/gcc/config/i386/i386.cc\n@@ -8627,7 +8627,7 @@ ix86_update_stack_alignment (rtx, const_rtx pat, void *data)\n \t unsigned int alignment = MEM_ALIGN (op);\n \n \t if (alignment > *p->stack_alignment)\n-\t\t*p->stack_alignment = alignment;\n+\t\t*p->stack_alignment = MIN (alignment, BIGGEST_ALIGNMENT);\n \t break;\n \t }\n \t else\ndiff --git a/gcc/function.cc b/gcc/function.cc\nindex bba05f3380d..41987b4f7a4 100644\n--- a/gcc/function.cc\n+++ b/gcc/function.cc\n@@ -2825,7 +2825,7 @@ assign_parm_remove_parallels (struct assign_parm_data_one *data)\n always valid and properly aligned. */\n \n static void\n-assign_parm_adjust_stack_rtl (struct assign_parm_data_one *data)\n+assign_parm_adjust_stack_rtl (tree parm, struct assign_parm_data_one *data)\n {\n rtx stack_parm = data->stack_parm;\n \n@@ -2840,7 +2840,15 @@ assign_parm_adjust_stack_rtl (struct assign_parm_data_one *data)\n \t\t\t\t\t\t MEM_ALIGN (stack_parm))))\n \t || (data->nominal_type\n \t && TYPE_ALIGN (data->nominal_type) > MEM_ALIGN (stack_parm)\n-\t && MEM_ALIGN (stack_parm) < PREFERRED_STACK_BOUNDARY)))\n+\t /* When we can re-align the stack ensure appropriate alignment\n+\t\t of the function local object up to BIGGEST_ALIGNMENT if\n+\t\t it is only accessed directly or up to the maximum supported\n+\t\t alignment if the address is exposed. */\n+\t && MEM_ALIGN (stack_parm) < (SUPPORTS_STACK_ALIGNMENT\n+\t\t\t\t\t ? (TREE_ADDRESSABLE (parm)\n+\t\t\t\t\t ? MAX_SUPPORTED_STACK_ALIGNMENT\n+\t\t\t\t\t : BIGGEST_ALIGNMENT)\n+\t\t\t\t\t : PREFERRED_STACK_BOUNDARY))))\n stack_parm = NULL;\n \n /* If parm was passed in memory, and we need to convert it on entry,\n@@ -3714,7 +3722,7 @@ assign_parms (tree fndecl)\n else\n \tset_decl_incoming_rtl (parm, data.entry_parm, false);\n \n- assign_parm_adjust_stack_rtl (&data);\n+ assign_parm_adjust_stack_rtl (parm, &data);\n \n if (assign_parm_setup_block_p (&data))\n \tassign_parm_setup_block (&all, parm, &data);\ndiff --git a/gcc/testsuite/gcc.dg/torture/pr120839.c b/gcc/testsuite/gcc.dg/torture/pr120839.c\nnew file mode 100644\nindex 00000000000..158e800649f\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/torture/pr120839.c\n@@ -0,0 +1,7 @@\n+/* { dg-do compile } */\n+\n+typedef struct {\n+ long double a, b;\n+} c __attribute__((aligned(32)));\n+double d;\n+void e(c f) { d = f.a; }\ndiff --git a/gcc/testsuite/gcc.target/i386/pr120839-avx.c b/gcc/testsuite/gcc.target/i386/pr120839-avx.c\nnew file mode 100644\nindex 00000000000..1f5406e065c\n--- /dev/null\n+++ b/gcc/testsuite/gcc.target/i386/pr120839-avx.c\n@@ -0,0 +1,8 @@\n+/* { dg-do compile } */\n+/* { dg-options \"-O -mavx\" } */\n+\n+typedef struct {\n+ long double a, b;\n+} c __attribute__((aligned(32)));\n+double d;\n+void e(c f) { d = f.a; }\n", "prefixes": [] }