https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119458
Bug ID: 119458
Summary: Optimisation miss: atomic_ref increment
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: tymi at tymi dot org
Target Milestone: ---
Following code:
```cpp
int main(void)
{
int x{};
std::atomic_ref(x) += 100;
std::atomic_ref(x)--;
return 0;
}
```
Produces add and sub instructions. It could produce add and dec instead. This
is the case with clang