On 6/24/2026 9:19 AM, Xi Ruoyao wrote:
On Wed, 2026-06-24 at 23:11 +0800, YunQiang Su wrote:
Xi Ruoyao <[email protected]> 于2026年6月23日周二 22:10写道:
In GCC, if the RTL template of define_insn has multiple elements, it's
treated as a parallel expression.  And, "in parallel" means that first
all the values used in the invidiviual side-effects are computed, and
second all the actual side-effects are performed.  So when the value of
operand 1 (the output reg) is used, it's not set yet.

When optimization is enabled, the uninitialized value is replaced with 0
and then for e.g. if atomic_hiqi_op is plus, (plus (0) (val)) is folded
to simply (val).  Now the RTL template happens to be matched by
sync_old_nand_12 (of which the RTL is written in a really inconsistent
way), causing "0 + 1 = -1".

Is there any test case for it?
As the PR indicates, the bug already causes the test case stdatomic-op-
1.c to fail (actually, alongside some dozens of other tests).  So we can
consider the test case already existing.
Yea, that's standard practice.  Thanks for confirming it's already covered by existing tests.

jeff

Reply via email to