From patchwork Mon Oct 29 12:06:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 194989 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 6CE3B2C0084 for ; Mon, 29 Oct 2012 23:07:08 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1352117229; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Subject:Message-ID:MIME-Version: Content-Type:Content-Disposition:User-Agent:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=7F37QQDe/bgGCwsaQHmUiCnRdwI=; b=MGuoppyZrKKIwBp1And+xEr5N4rJlA8W0rHIlPOsesTWleud/ys1H7cFd4mF1Z aABr7X3IuHqw87Q04SIIcwzCIClSSNcm9V3QHKWbyQrtAESIwHlwH/etflwD/T4E E3sdhgcccHZUagqEmIuvMavWNWmuPn+2l14KMZVwqZ1D4= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=CbhkeWyfWfYwN2FdRjjiIm0W7ucBd7IQ0IhRaB89OgNzOgQFZGcbfsKQC83NwY VFH2CXuxnizfYbRq/p/BiVI0TxTNTDBZkqptKCBlD0RqZXiB2qAVlQHKs++0Jlmm MZIQ8XrqpQmyai/oRmPVxLvi9lusNlSNq1RdGOkfLFKZY=; Received: (qmail 19315 invoked by alias); 29 Oct 2012 12:07:02 -0000 Received: (qmail 19305 invoked by uid 22791); 29 Oct 2012 12:07:01 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, TW_TM X-Spam-Check-By: sourceware.org Received: from mail-pb0-f47.google.com (HELO mail-pb0-f47.google.com) (209.85.160.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 29 Oct 2012 12:06:56 +0000 Received: by mail-pb0-f47.google.com with SMTP id ro12so3967056pbb.20 for ; Mon, 29 Oct 2012 05:06:55 -0700 (PDT) Received: by 10.66.84.196 with SMTP id b4mr20686506paz.41.1351512415650; Mon, 29 Oct 2012 05:06:55 -0700 (PDT) Received: from gnu-tools-1.localdomain ([180.154.77.211]) by mx.google.com with ESMTPS id w4sm5857708pav.27.2012.10.29.05.06.52 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 29 Oct 2012 05:06:54 -0700 (PDT) Received: by gnu-tools-1.localdomain (Postfix, from userid 1000) id 877261B5495; Mon, 29 Oct 2012 05:06:01 -0700 (PDT) Date: Mon, 29 Oct 2012 05:06:01 -0700 From: "H.J. Lu" To: gcc-patches@gcc.gnu.org Subject: PATCH: Correct alloca length in dump_gimple_bb_header Message-ID: <20121029120601.GA19039@gmail.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list 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);