https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62121
--- Comment #4 from Jan Hubicka <hubicka at gcc dot gnu.org> --- I am testing the following for 4.9 branch: Index: ipa-devirt.c =================================================================== --- ipa-devirt.c (revision 215890) +++ ipa-devirt.c (working copy) @@ -994,7 +994,8 @@ give_up: if ((TREE_CODE (type) != RECORD_TYPE || !TYPE_BINFO (type) || !polymorphic_type_binfo_p (TYPE_BINFO (type))) - && (TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST + && (!TYPE_SIZE (type) + || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST || (offset + tree_to_uhwi (TYPE_SIZE (expected_type)) <= tree_to_uhwi (TYPE_SIZE (type))))) return true;