From patchwork Wed Nov 23 22:51:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 698543 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tPHdl3kLQz9t1T for ; Thu, 24 Nov 2016 09:51:54 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="xfYmoRQN"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=OmrWcDDc7gi2SvVfQFkdsUwdhqkDIfvChFtkOhx06LTT+qgwR6 34dRCGsRz0Kq95A5bK+KPx23LfmJXdH5RRgO7YmpTwBsiPMYotj5Ftytsyd8niq0 tgIdsWrrFbD+a+Mw4J4EC4QmeEm9cPv/aHi4cbYhsDf5xhDbYX+ioK898= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=2TQf5te+ZgM6DBSOW4yP06J3a0M=; b=xfYmoRQNJkyI0TUW3FZT bYRvE2TJR1PycvAfi5/i/0I3fykrgDNzeGrZ064cziePycWfXm7FhFpFre640Kyj UFCM/q26z2JQ/t4mnVP+lG/z5oXod/KrTvZ0xJJ0m4yDt6Fqd/SvGRsdP/ncc+3U TxR1Z0s9ZfMuYQQAFxXSfpQ= Received: (qmail 37199 invoked by alias); 23 Nov 2016 22:51:45 -0000 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 Received: (qmail 37186 invoked by uid 89); 23 Nov 2016 22:51:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.8 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1617, month X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 23 Nov 2016 22:51:34 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6B7DB636FE for ; Wed, 23 Nov 2016 22:51:33 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-64.phx2.redhat.com [10.3.116.64]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uANMpXnV031647 for ; Wed, 23 Nov 2016 17:51:33 -0500 To: gcc-patches From: Jeff Law Subject: Fix sprintf buffer warning in assemble_name Message-ID: Date: Wed, 23 Nov 2016 15:51:32 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 X-IsSubscribed: yes Until we sort out a reasonable API and implementation for building up label strings, this will have to be sufficient. As outlined earlier this month, when we build up label names, part of the name is hidden in the backend, part in the caller. As a result there's no good way to get the length and size the array. sparc uses more characters than any other in-tree port and as a result it could (with sufficient local labels) do an out-of-range write into the name array when building a local label. This patch increases the buffer by one char which is sufficient to avoid the problem. Installing on the trunk. Jeff commit c348c67f8c305df504e88659eecf0f5c9994618a Author: law Date: Wed Nov 23 22:48:45 2016 +0000 * varasm.c (assemble_name): Increase buffer size for name. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242810 138bc75d-0d04-0410-961f-82ee72b054a4 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 23f2c16..46b023e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,7 @@ 2016-11-23 Jeff Law + * varasm.c (assemble_name): Increase buffer size for name. + * config/spu/spu.md (floatunsdidf2): Remove unused local variable. 2016-11-23 Jakub Kicinski diff --git a/gcc/varasm.c b/gcc/varasm.c index 2c238950..2a20f64 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -2547,7 +2547,7 @@ assemble_name (FILE *file, const char *name) rtx assemble_static_space (unsigned HOST_WIDE_INT size) { - char name[16]; + char name[17]; const char *namestring; rtx x;