https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91375
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- TYPE_BINFO (DECL_CONTEXT (vtable)) is NULL. DECL_CONTEXT is BDS_Mesh here, from the -O0 compile where it is cleared here: static void free_lang_data_in_type (tree type, class free_lang_data_d *fld) { ... if (TYPE_BINFO (type)) { free_lang_data_in_binfo (TYPE_BINFO (type)); /* We need to preserve link to bases and virtual table for all polymorphic types to make devirtualization machinery working. */ if (!BINFO_VTABLE (TYPE_BINFO (type)) || !flag_devirtualize) TYPE_BINFO (type) = NULL; so I guess that flag_devirtualize is to blame since it may differ between CUs and type merging may chose the instance from a !flag_devirtualize one. A fix could be as simple as removing the !flag_devirtualize case. Honza?