From patchwork Thu Jun 4 11:05:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Renlin Li X-Patchwork-Id: 480628 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 B1E8114027C for ; Thu, 4 Jun 2015 21:06:06 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=Z+aekr7o; 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 :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=br8TjetsIC+SMJsLSDYOhgWgY5tL9EJcCieA/FfKUUI ydtbXfIC/c0OukaF30os5uazjWs1EeQWZOrZ1iCc7ql3Yws5hUBb0Hx1+1FH7LaH W4Qu4pCr7MEoihx1jUvRxwrlsVxr0Vecj3d8e5Ix6jlkOGDyB/MLbGR4TB8tsQMg = 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 :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=t+w9fqgTLJQWL4o3C1gnDUySZu8=; b=Z+aekr7omxTwLQ8QX QvhxaSuLOp52F2sAE/Fb9A+AuH9ZeQTyFrnSS1C69fRH+NrNdYTZifxN8oTcFZ5e /h5uXs+8eA8KcZhwPqHAT+nY/UURQ1EDVPxoTSX06VpT7zjEl/5ORQGuT6UKEYbG fCHCMNz3XHNpcBXBiQGIj9ssJk= Received: (qmail 56333 invoked by alias); 4 Jun 2015 11:05:57 -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 56187 invoked by uid 89); 4 Jun 2015 11:05:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (207.82.80.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 04 Jun 2015 11:05:53 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by uk-mta-24.uk.mimecast.lan; Thu, 04 Jun 2015 12:05:50 +0100 Received: from [10.2.207.43] ([10.1.2.79]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 4 Jun 2015 12:05:50 +0100 Message-ID: <5570310E.9070201@arm.com> Date: Thu, 04 Jun 2015 12:05:50 +0100 From: Renlin Li User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Ramana Radhakrishnan , Marcus Shawcroft , aldot@gcc.gnu.org Subject: [PATCH]Use "unsigned int" instead of "int" to hold alignment in emit_local function. X-MC-Unique: J9EmWYhdQuefJFfR0ab8hA-1 X-IsSubscribed: yes Hi all, This is a simple patch to change the align variable (used in emit_local()) from type "int" to type "unsigned int". It should be defined as "unsigned int" which is the same data type returned by symtab_node::get (decl)->definition_alignment () For the maximum alignment allowed by GCC(without producing "error: requested alignment is too large"), "int" will overflow. Okay to Commit on the trunk and backport to branch 5.0? Regards, Renlin Li gcc/ChangeLog: 2015-06-04 Renlin Li * varasm.c (emit_local): Use unsigned int for align variable. diff --git a/gcc/varasm.c b/gcc/varasm.c index 93b9699..8f9b7ec 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -1960,12 +1960,12 @@ emit_local (tree decl ATTRIBUTE_UNUSED, unsigned HOST_WIDE_INT rounded ATTRIBUTE_UNUSED) { #if defined ASM_OUTPUT_ALIGNED_DECL_LOCAL - int align = symtab_node::get (decl)->definition_alignment (); + unsigned int align = symtab_node::get (decl)->definition_alignment (); ASM_OUTPUT_ALIGNED_DECL_LOCAL (asm_out_file, decl, name, size, align); return true; #elif defined ASM_OUTPUT_ALIGNED_LOCAL - int align = symtab_node::get (decl)->definition_alignment (); + unsigned int align = symtab_node::get (decl)->definition_alignment (); ASM_OUTPUT_ALIGNED_LOCAL (asm_out_file, name, size, align); return true; #else