Landing: 325646488a30

Project / Subsystem

gcc / builtins

Date

2026-09-22

Author

Jakub Jelinek

Commit

325646488a306c36c28e84260b4dd551bd30a47f

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
builtins
patch_id
—
commit_hash
325646488a306c36c28e84260b4dd551bd30a47f
source_type
github
headline
Fix fallback for atomic builtins when operands are memory
tldr
Ensures atomic operations correctly handle memory operands by forcing them into registers, preventing data races.
author
Jakub Jelinek
outcome
committed
performance_win
false
breaking_change
false
series_id
—
series_parts
[]
tags
  • • builtins
  • • atomics
  • • bugfix
  • • threading
discussion_id_link
—
bugzilla_pr
—
date
2026-09-22T00:00:00.000Z

This commit fixes a bug where atomic builtins could incorrectly expand operands into memory locations, leading to potential data races. The expand_builtin_atomic_fetch_op and expand_ifn_atomic_bit_test_and functions now ensure that memory operands are first forced into a pseudo-register before the atomic operation is performed. This improves the reliability of atomic operations when operands might otherwise be subject to modification during expansion.