This is the failure of the new assertion added in the REG_ARGS_SIZE case of distribute_notes in the combiner on a degenerated case (complete folding of a dynamic stack allocation). Fixed by dropping the note if the resulting insn is a no-op move.
Tested on i586-suse-linux, applied on the mainline. 2011-10-16 Eric Botcazou <ebotca...@adacore.com> PR rtl-optimization/50615 * combine.c (distribute_notes) <REG_ARGS_SIZE>: Skip if I3 is a no-op. 2011-10-16 Eric Botcazou <ebotca...@adacore.com> * gcc.dg/vla-23.c: New test. -- Eric Botcazou
Index: combine.c =================================================================== --- combine.c (revision 179844) +++ combine.c (working copy) @@ -13274,13 +13274,14 @@ distribute_notes (rtx notes, rtx from_in break; case REG_ARGS_SIZE: - { - /* ??? How to distribute between i3-i1. Assume i3 contains the - entire adjustment. Assert i3 contains at least some adjust. */ - int old_size, args_size = INTVAL (XEXP (note, 0)); - old_size = fixup_args_size_notes (PREV_INSN (i3), i3, args_size); - gcc_assert (old_size != args_size); - } + /* ??? How to distribute between i3-i1. Assume i3 contains the + entire adjustment. Assert i3 contains at least some adjust. */ + if (!noop_move_p (i3)) + { + int old_size, args_size = INTVAL (XEXP (note, 0)); + old_size = fixup_args_size_notes (PREV_INSN (i3), i3, args_size); + gcc_assert (old_size != args_size); + } break; case REG_NORETURN:
/* PR rtl-optimization/50615 */ /* Testcase by Zdenek Sojka <zso...@seznam.cz> */ /* { dg-do compile } */ /* { dg-options "-O --param max-cse-insns=1" } */ int foo (int a) { if (!a) return 1; { int s[a]; return 0; } }