CodeGen: set correct result for atomic compound expressions
authorTim Northover <t.p.northover@gmail.com>
Thu, 7 Nov 2019 13:36:03 +0000 (13:36 +0000)
committerTim Northover <t.p.northover@gmail.com>
Thu, 7 Nov 2019 13:36:44 +0000 (13:36 +0000)
commit10e0d64337d64ebdb658bf9108bd9bb48fb5390c
tree1feb4f9038679ad3fd3cef89ab676f2568b4234e
parent0ec6a4882eeb34338b916567f8e63fb71afc84fd
CodeGen: set correct result for atomic compound expressions

Atomic compound expressions try to use atomicrmw if possible, but this
path doesn't set the Result variable, leaving it to crash in later code
if anything ever tries to use the result of the expression. This fixes
that issue by recalculating the new value based on the old one
atomically loaded.
clang/lib/CodeGen/CGExprScalar.cpp
clang/test/CodeGen/atomic_ops.c