[llvm-bugs] [Bug 42782] New: compound assignment invalid operands
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Jul 26 09:48:47 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42782
Bug ID: 42782
Summary: compound assignment invalid operands
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: jaopaulolc at gmail.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
Created attachment 22295
--> https://bugs.llvm.org/attachment.cgi?id=22295&action=edit
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).
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190726/05e21a28/attachment-0001.html>
More information about the llvm-bugs
mailing list