]> git.ipfire.org Git - thirdparty/gcc.git/commit
middle-end/66279 - gimplification clobbers shared asm constraints
authorRichard Biener <rguenther@suse.de>
Fri, 28 Feb 2025 08:58:36 +0000 (09:58 +0100)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 2 Apr 2025 07:23:07 +0000 (09:23 +0200)
commit12b536c17d28500fa9ad32563ae6088726162051
treec766f4114f968263a21f200b54ceb24937dfd0b1
parent8274de2e614f0c5d20b55fd1d42efca2695a610d
middle-end/66279 - gimplification clobbers shared asm constraints

When the C++ frontend clones a CTOR we do not copy ASM_EXPR constraints
fully as walk_tree does not recurse to TREE_PURPOSE of TREE_LIST nodes.
At this point doing that seems too dangerous so the following instead
avoids gimplification of ASM_EXPRs to clobber the shared constraints
and unshares it there, like it also unshares TREE_VALUE when it
re-writes a "+" output constraint to separate "=" output and matching
input constraint.

PR middle-end/66279
* gimplify.cc (gimplify_asm_expr): Copy TREE_PURPOSE before
rewriting it for "+" processing.

* g++.dg/pr66279.C: New testcase.

(cherry picked from commit 95f5d6cc17e7d6b689674756c62b6b5e1284afd0)
gcc/gimplify.cc
gcc/testsuite/g++.dg/pr66279.C [new file with mode: 0644]