https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113596
--- Comment #12 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:7117e1f6bf6de25c1ff26c4d7abcc79b407ca221 commit r15-125-g7117e1f6bf6de25c1ff26c4d7abcc79b407ca221 Author: Jakub Jelinek <ja...@redhat.com> Date: Fri May 3 09:44:30 2024 +0200 tree-inline: Add __builtin_stack_{save,restore} pair about inline calls with calls to alloca [PR113596] The following patch adds save_NNN = __builtin_stack_save (); ... __builtin_stack_restore (save_NNN); pair around inline calls which call alloca (alloca calls because of VLA vars are ignored in that decision). The patch doesn't change anything on whether we try to inline such calls or not, it just fixes the behavior when we inline them despite those checks. The stack save/restore restores the behavior that alloca acquired regions are freed at the end of the containing call. 2024-05-03 Jakub Jelinek <ja...@redhat.com> PR middle-end/113596 * tree-inline.cc (expand_call_inline): Emit __builtin_stack_save and __builtin_stack_restore calls around inlined functions which call alloca. * gcc.dg/pr113596.c: New test. * gcc.dg/tree-ssa/pr113596.c: New test.