Landing: ce93e13e31a4

Project / Subsystem

gcc / c++

Date

2026-05-07

Author

Jakub Jelinek

Commit

ce93e13e31a4886ce6f16a6b0963838885c0297d

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
c++
patch_id
commit_hash
ce93e13e31a4886ce6f16a6b0963838885c0297d
source_type
github
headline
Constant Evaluation Handles Pointer Conversions in Object Size Builtins
tldr
GCC now performs constant evaluation of the `__builtin_object_size` and `__builtin_dynamic_object_size` builtins, handling pointer conversions for more accurat…
author
Jakub Jelinek
outcome
committed
performance_win
true
breaking_change
false
series_id
series_parts
[]
tags
  • c++
  • constexpr
  • builtins
  • object size
  • optimization
discussion_id_link
bugzilla_pr
date
2026-05-07T00:00:00.000Z

GCC’s constant evaluation now supports __builtin_object_size and __builtin_dynamic_object_size, even when pointer conversions are involved. Previously, the evaluation was limited to direct address expressions, which could lead to security regressions. This enhancement, performed in the frontend, strips pointer casts to improve accuracy during constant evaluation, particularly when the full object size is unknown.