[Bug tree-optimization/85244] [6/7/8 Regression] Bad optimisation with flexible array member (may be related to -ftree-dominator-opts)
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Apr 6 07:55:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85244
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
That said, it is get_ref_base_and_extent that for the variable index returns
offset 96 bits and size == maxsize == 32, identical to the [0] case.
Perhaps we shouldn't trust:
638 /* If maxsize is unknown adjust it according to the size of the
639 base decl. */
640 else if (!known_size_p (maxsize)
641 && DECL_SIZE (exp)
642 && poly_int_tree_p (DECL_SIZE (exp)))
643 maxsize = wi::to_poly_offset (DECL_SIZE (exp)) - bit_offset;
if exp is DECL_EXTERNAL and the struct/union ends with flexible array member
(or flexible array member-like array)? Perhaps we'd need to remember from the
case where we set seen_variable_array_ref to true if it was
array_at_end_of_struct_p and if yes and DECL_EXTERNAL, ignore this?
Richard?
More information about the Gcc-bugs
mailing list