Landing: be20f2a5b788
Project / Subsystem
gcc / optabs
Date
2026-09-14
Author
Jakub Jelinek
Commit
be20f2a5b7887853833308617292d271be91414b
Source
github
Perf win
No
Breaking
No
All attributes
- project
- gcc
- subsystem
- optabs
- patch_id
- —
- commit_hash
- be20f2a5b7887853833308617292d271be91414b
- source_type
- github
- headline
- optabs: Fix atomic builtins expansion with aliasing memory
- tldr
- Corrects incorrect code generation for atomic builtins when memory operands might alias.
- author
- Jakub Jelinek
- outcome
- committed
- performance_win
- false
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optabs
- • atomic operations
- • compiler bug
- • memory aliasing
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-09-14T00:00:00.000Z
This commit addresses a bug in the fallback expansions of several GCC atomic builtins. When the operand involved in a TER operation is a MEM (or contains one) that could alias with the memory being atomically updated, incorrect code was generated. This patch forces the val operand into a pseudo register in such cases, resolving issues where the updated value was incorrectly used instead of the original value. It also fixes a problem where val could be read twice in compare-and-exchange loops.