From patchwork Fri May 16 08:29:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Clifton X-Patchwork-Id: 349504 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 BA9FA140087 for ; Fri, 16 May 2014 18:30:03 +1000 (EST) 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:references :in-reply-to:content-type:content-transfer-encoding; q=dns; s= default; b=jxXjfeM3HsEhSbBUINEtNoL1DXc8zWBq2h9j7Ijpm820+cLGxB45z l2AvvjREZ6NSCcu9bDPKpAEtzZs18KH8tvmxwrjynv7t864xnc2gf3FyrGHk5Dhd ZSqzeioNUyn5zIwxWUkUjdHhQx/dwERCHFylosh5pSr8nfEsFVDQ8c= 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:references :in-reply-to:content-type:content-transfer-encoding; s=default; bh=jjoEgtmN44E4k2XLnKe65VHPajw=; b=fGmnd80qXvqtZ0z8ec0Orm/ET1Bx ESJzon4hvY8RX7eqeyfvtbsvwo8DoTNwVN5eYmOb58/S8eAlXyGgunIk/7Kzja3k KtRcafz00z3u7GX2wr2DbPQQnlt9FWsYrLTmmu2Y2kmXPWEchPaCZ18LQeu20u/F 4hkAr/R+t++5s70= Received: (qmail 6062 invoked by alias); 16 May 2014 08:29: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 6024 invoked by uid 89); 16 May 2014 08:29:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.2 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 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; Fri, 16 May 2014 08:29:52 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s4G8TnAO014015 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 May 2014 04:29:49 -0400 Received: from [10.36.7.68] (vpn1-7-68.ams2.redhat.com [10.36.7.68]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s4G8TlId018479 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 16 May 2014 04:29:49 -0400 Message-ID: <5375CC7B.7070202@redhat.com> Date: Fri, 16 May 2014 09:29:47 +0100 From: Nicholas Clifton User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Eric Botcazou CC: gcc-patches@gcc.gnu.org Subject: Re: RFA: Fix calculation of size of builtin setjmp buffer References: <87wqdzjccp.fsf@redhat.com> <3114307.feqyCiYPCg@polaris> <53737067.2030608@redhat.com> <2347976.UgdYmbUUr8@polaris> In-Reply-To: <2347976.UgdYmbUUr8@polaris> X-IsSubscribed: yes Hi Eric, OK - here is your version of the patch, extended with a comment which I think is helpful for other people reading the code, and with the changes to builtins.c and md.texi removed, since the size of the buffer is not changing. Is this version OK to apply ? Cheers Nick gcc/ChangeLog 2014-05-16 Nick Clifton * except.c (init_eh): Correct computation of the size of a builtin setjmp buffer for when pointers are bigger than words. Index: gcc/except.c =================================================================== --- gcc/except.c (revision 210490) +++ gcc/except.c (working copy) @@ -286,9 +286,22 @@ tmp = size_int (FIRST_PSEUDO_REGISTER + 2 - 1); #endif #else - /* builtin_setjmp takes a pointer to 5 words. */ - tmp = size_int (5 * BITS_PER_WORD / POINTER_SIZE - 1); + /* Compute a minimally sized jump buffer. We need room to store at + least 3 pointers - stack pointer, frame pointer and return address. + Plus for some targets we need room for an extra pointer - in the + case of MIPS this is the global pointer. This makes a total of four + pointers, but to be safe we actually allocate room for 5. + + If pointers are smaller than words then we allocate enough room for + 5 words, just in case the backend needs this much room. For more + discussion on this issue see: + http://gcc.gnu.org/ml/gcc-patches/2014-05/msg00313.html. */ + if (POINTER_SIZE > BITS_PER_WORD) + tmp = size_int (5 - 1); + else + tmp = size_int ((5 * BITS_PER_WORD / POINTER_SIZE) - 1); #endif tmp = build_index_type (tmp); tmp = build_array_type (ptr_type_node, tmp);