Created attachment 22295
stack dump
The code I am attaching has 2 compound assignments where variable x is the LHS,
respectively, line 6 and 8.
The assignment on line 6 works fine. However line 8's assignment triggers the
following error:
atomic.c:8:5: error: invalid operands to binary expression ('_Atomic(int)' and
'_Atomic(int)')
The problem seems to be the fact that only the LHS' _Atomic type-specifier is
ignored here:
https://github.com/llvm/llvm-project/blob/736e8aa8ed48fd8c29a909bf616965d0f8677bca/clang/lib/Sema/SemaExpr.cpp#L1358
Which makes LHSType and RHSType different and triggers the error message here:
https://github.com/llvm/llvm-project/blob/736e8aa8ed48fd8c29a909bf616965d0f8677bca/clang/lib/Sema/SemaExpr.cpp#L9462
I tried to "fix" this by adding the following right after SemaExpr.cpp#L1358:
if (const AtomicType *AtomicRHS = RHSType->getAs<AtomicType>())
RHSType = AtomicRHS->getValueType();
However this breaks the CodeGen at ScalarExprEmitter::EmitCompoundAssignLValue.
(please find all resources attached).
stack-dump.txt
(6748 bytes, text/plain)atomic.c
(145 bytes, text/x-csrc)atomic-ba869c.sh
(1820 bytes, application/x-shellscript)