https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99122
--- Comment #6 from Martin Jambor <jamborm at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #5) > That could perhaps work for the #c0 testcase where the function actually has > a non-VL parameter and so garbage in garbage out. > But would that work also for #c2? No, at least not on its own. It leaks struct S, which is local to bar, to the IL of foo, which hits an assert in make_decl_rtl. Einline dump has: struct T b; ... x.1_28 = __builtin_alloca_with_align (_26, 8); _20 = (long unsigned int) n_14(D); _21 = &x.1_28->a; __builtin_memset (_21, 0, _20); b = MEM <struct T> [(struct S *)x.1_28]; > If one dumps the #c2 testcase with -O2 -fno-inline -fdump-tree-optimized, > the PARM_DECL is clearly variable length but not lowered to *ptr, while > in the caller it is lowered that way and allocated through > __builtin_alloca_with_align. > So, clearly PARM_DECLs can be variable length but VAR_DECLs should not be > (they should be gimplified into ptr = __builtin_alloca_with_align with stack > save/restore around the scope and DECL_VALUE_EXPR of *ptr. > The inliner certainly doesn't do that right now. > > For punting on inlining these, I couldn't find any spot that would try to > verify at least remote compatibility of the passed in arguments and the > arguments the callee expects. No, with LTO it would be too late even if we tried to, (IPA) inlining decisions are not meant to be un-doable. The idea was that mismatches are undefined and so we should try our best to emulate non-inlining and not ICE. But apparently we don't manage that now.