https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88140
--- Comment #3 from rguenther at suse dot de <rguenther at suse dot de> --- On Thu, 22 Nov 2018, hubicka at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88140 > > --- Comment #2 from Jan Hubicka <hubicka at gcc dot gnu.org> --- > I am testing: > Index: tree-cfg.c > =================================================================== > --- tree-cfg.c (revision 266382) > +++ tree-cfg.c (working copy) > @@ -3196,8 +3196,8 @@ verify_types_in_gimple_reference (tree e > error ("invalid COMPONENT_REF offset operator"); > return true; > } > - if (!useless_type_conversion_p (TREE_TYPE (expr), > - TREE_TYPE (TREE_OPERAND (expr, 1)))) > + if (!useless_type_conversion_p (TREE_TYPE (TREE_OPERAND (expr, 1)), > + TREE_TYPE (expr))) > { > error ("type mismatch in component reference"); > debug_generic_stmt (TREE_TYPE (expr)); That's broken. I'd rather adjust useless_type_conversion_p. We have here incomplete-X *[] vs. complete-X *[], right? But how does 174 && (!TYPE_SIZE (inner_type) 175 || TREE_CODE (TYPE_SIZE (inner_type)) != INTEGER_CST 176 || !tree_int_cst_equal (TYPE_SIZE (outer_type), 177 TYPE_SIZE (inner_type)))) anything differ here? The sizes of the pointers are equal!? Ah, (gdb) p inner_type->type_common.size $1 = <tree 0x0> (gdb) p outer_type->type_common.size $2 = <integer_cst 0x7ffff687ad08> why's that?! That's probably the issue. For ARRAY_TYPEs you have to avoid doing TYPE_SIZE() = NULL; since you only want to make pointed-to types of elements incomplete.