https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68680
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 36903 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36903&action=edit gcc6-pr68680.patch Seems the problem is that with the addition of __builtin_alloca_with_align, which is now used for VLAs, the code has not been adjusted to make sure that cfun->calls_alloca is set already during the GIMPLE optimizers, so it will be set only during expansion, when expanding that builtin (which calls allocate_dynamic_stack_space). There are a few spots that care about cfun->calls_alloca even before that: 1) stack protector (is testing this at the start of expansion, so before the builtin has been expanded) 2) tailcall optimization (I'd expect we want to continue what 4.6 and older did, forbid tail calls if there are even VLAs, but am not 100% sure) 3) the inliner (again, not 100% sure we want to handle VLAs as alloca, but maybe we should) 4) some missed optimizations (tests whether result of the __builtin_alloca_with_align will be always non-NULL) The patch just arranges for the VLAs to be treated like alloca for these purposes. If that is not what we want now in some of the cases - 1) surely wants to handle them as 4.6 did - then perhaps we need two separate ECF_ flags and two separate cfun-> bit fields.