[clang] [clang] Fix crash in code with StmtExpr and atomic char load in Expr::EvaluateAsRValue. (PR #106751)
Daniel Petrovic via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 2 00:40:35 PDT 2024
daniel-petrovic wrote:
The statement expression should always provide r-value: https://clang.llvm.org/doxygen/classclang_1_1StmtExpr.html#details
According https://en.cppreference.com/w/c/language/atomic:
> Atomic properties are only meaningful for [lvalue expressions](https://en.cppreference.com/w/c/language/value_category). Lvalue-to-rvalue conversion (which models a memory read from an atomic location to a CPU register) strips atomicity along with other qualifiers.
To me it looks like that atomicity in StmExpr is not stripped away, but it should.
E.g. : https://godbolt.org/z/WPdh9Yx5h
` `-RecoveryExpr <col:12, col:23> 'char' contains-errors
`-StmtExpr <col:12, col:23> 'atomic_char':'_Atomic(char)'`
https://github.com/llvm/llvm-project/pull/106751
More information about the cfe-commits
mailing list