https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64741
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The C FE does for vars with flexible array members with initializers: DECL_SIZE (decl) = size_binop (PLUS_EXPR, DECL_SIZE (decl), TYPE_SIZE (type)); DECL_SIZE_UNIT (decl) = size_binop (PLUS_EXPR, DECL_SIZE_UNIT (decl), TYPE_SIZE_UNIT (type)); So what about doing the same (with type replaced by TREE_TYPE (str))?