diff --git a/gcc/ipa-struct-reorg/ipa-struct-reorg.c b/gcc/ipa-struct-reorg/ipa-struct-reorg.c index 4751711fed6dcb6fca49b3fb11760f8c4d8865f3..2cac340c71581dbe57dee00d1f17cb45e0198ee0 100644 --- a/gcc/ipa-struct-reorg/ipa-struct-reorg.c +++ b/gcc/ipa-struct-reorg/ipa-struct-reorg.c @@ -6408,6 +6408,8 @@ ipa_struct_reorg::is_semi_relayout_candidate (tree xhs) { tree type = TREE_TYPE (mem); srtype *old_type = get_relayout_candidate_type (type); + if (!old_type) + return false; if (types_compatible_p (type, old_type->type) && old_type->semi_relayout) return true;