> I think you should also handle duplicate_thunk_for_node in > cgraphclones.c. That function clones thunks when the function they > belong to gets cloned. If you think you don't need to handle it for one > reason or another, at the very least put an assert there that > indirect_offset is zero.
Thanks for the heads up, now done, as well as in ipa-icf.c. > does this mean you can have thunks in one compilation unit that belong > to a function in another compilation unit? Interesting... Yes, we can in Ada because the compilation model is different. > If I read this correctly (and the offset is an int), nowadays you might > just want to do simple > > stmt = gimple_build_assign (offset_tree, > fold_build2 (MEM_REF, > integer_type_node, > ptr, > build_int_cst > (build_pointer_type (integer_type_node), indirect_offset))); > > instead of all of the above? You might then also leave the creation of > vtable_entry_type where it is now. The new code uses the same pattern as the existing code just above though. -- Eric Botcazou