Landing: 5e492f27e44c

Project / Subsystem

gcc / gcc

Date

2026-04-17

Author

Jan Hubicka

Commit

5e492f27e44c052237a7296d7fb754bae5755982

Source

github

Impact

5/10

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
gcc
patch_id
commit_hash
5e492f27e44c052237a7296d7fb754bae5755982
source_type
github
headline
Fix handling of anonymous type vtables in ipa-devirt.
tldr
The compiler now correctly handles anonymous type vtables during interprocedural devirtualization by tracking construction vtables of derived types.
why_it_matters
Ensures correct devirtualization of C++ code that uses anonymous types and inheritance, preventing potential runtime errors.
author
Jan Hubicka
impact_score
5
impact_rationale
Fixes a code generation issue related to devirtualization and anonymous types.
outcome
committed
performance_win
false
breaking_change
false
series_id
series_parts
[]
tags
  • ipa
  • devirtualization
  • C++
  • vtables
  • bugfix
discussion_id_link
bugzilla_pr
date
2026-04-17T00:00:00.000Z

The compiler was generating wrong code due to incorrect handling of anonymous type vtables in ipa-devirt. The issue arises when an anonymous type is derived by another class and the anonymous type’s virtual table is not directly used, but its virtual functions are referenced through the derived class’s construction vtable. To fix this, the patch adds a walk of variables to note construction vtables when anonymous types are present.