Landing: a5e5c22ad486

Project / Subsystem

gcc / c++

Date

2026-07-31

Author

Jakub Jelinek

Commit

a5e5c22ad4862846ea705d43c640ca18cc9dd78a

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
c++
patch_id
—
commit_hash
a5e5c22ad4862846ea705d43c640ca18cc9dd78a
source_type
github
headline
C++: Avoid caching calls that rethrow or query exception state
tldr
Compiler now avoids caching function calls during constant evaluation if they involve exceptions.
author
Jakub Jelinek
outcome
committed
performance_win
false
breaking_change
false
series_id
—
series_parts
[]
tags
  • • c++
  • • constexpr
  • • exception handling
  • • optimization
discussion_id_link
—
bugzilla_pr
—
date
2026-07-31T00:00:00.000Z

This commit prevents the C++ compiler from caching function calls during constant evaluation if those calls involve exception handling mechanisms like rethrow, __builtin_uncaught_exceptions, or __builtin_current_exception. Caching such calls could lead to incorrect results if the execution context’s exception state changes. By marking these operations as non-cacheable, the compiler ensures more reliable constant evaluation in the presence of exceptions.