From patchwork Mon Oct 29 12:06:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: PATCH: Correct alloca length in dump_gimple_bb_header Date: Mon, 29 Oct 2012 02:06:01 -0000 From: "H.J. Lu" X-Patchwork-Id: 194989 Message-Id: <20121029120601.GA19039@gmail.com> To: gcc-patches@gcc.gnu.org Hi, When indent == 0, we call alloca with -1 bytes. This patch changes it to indent + 1. This is a trunk only regression. OK to install? Thanks. H.J. --- 2012-10-29 H.J. Lu * gimple-pretty-print.c (dump_gimple_bb_header): Correct alloca length. diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c index 4b3235e..62c315e 100644 --- a/gcc/gimple-pretty-print.c +++ b/gcc/gimple-pretty-print.c @@ -2093,7 +2093,7 @@ dump_gimple_bb_header (FILE *outf, basic_block bb, int indent, int flags) gimple stmt = first_stmt (bb); if (!stmt || gimple_code (stmt) != GIMPLE_LABEL) { - char *s_indent = (char *) alloca ((size_t) indent - 2 + 1); + char *s_indent = (char *) alloca ((size_t) indent + 1); memset (s_indent, ' ', (size_t) indent); s_indent[indent] = '\0'; fprintf (outf, "%s:\n", s_indent, bb->index);