Landing: 1bcce941ebbb

Project / Subsystem

gcc / middle-end

Date

2026-09-08

Author

Kyrylo Tkachov

Commit

1bcce941ebbb9ad97997a86432da88c8a9117d4b

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
middle-end
patch_id
—
commit_hash
1bcce941ebbb9ad97997a86432da88c8a9117d4b
source_type
github
headline
Use conservative store semantics for MEM_NOTRAP
tldr
Ensures correct non-trapping information by defaulting to conservative store semantics and re-evaluating loads.
author
Kyrylo Tkachov
outcome
committed
performance_win
false
breaking_change
false
series_id
—
series_parts
[]
tags
  • • optimization
  • • middle-end
discussion_id_link
—
bugzilla_pr
—
date
2026-09-08T00:00:00.000Z

This commit refines how the MEM_NOTRAP attribute is handled, particularly for stores. Previously, set_mem_attributes derived MEM_NOTRAP from tree_could_trap_p, which describes loads. This could incorrectly mark stores to unwritable memory as non-trapping. The changes introduce MAY_STORE_P and use lhs_could_trap_p for stores, defaulting MAY_STORE_P to true. This makes the handling more conservative for stores and ensures that loads expanded with non-normal modifiers have their MEM_NOTRAP recomputed later.