https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99122
--- Comment #32 from Richard Biener <rguenth at gcc dot gnu.org> --- + /* We cannot inline a function with a VLA typed argument or result since + we have no implementation materializing a variable of such type in + the caller. */ + if (COMPLETE_TYPE_P (TREE_TYPE (TREE_TYPE (fndecl))) + && !poly_int_tree_p (TYPE_SIZE (TREE_TYPE (TREE_TYPE (fndecl))))) + return true; so that would mean adding && !DECL_BY_REFERENCE (DECL_RESULT (fndecl)) I suppose or looking at DECL_RESULT in the first place (which is a pointer in that case).