From patchwork Tue May 15 10:22:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 159285 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 9DD2AB6F9A for ; Tue, 15 May 2012 20:24:14 +1000 (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=1337682254; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc: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=9lf4r0KfNwVGLsE12t0F 68JVlvE=; b=XGDUcM2OB5PE9yKVzbh/P8FfF4AOXvgcR4O2ReHkFYTIRrWuI1Y+ o7cLCVRQnePUywyOHegpKDd9t6F180RumxrZsuaAzpo+KNJNGhvoVuw5KoZWjin+ MCj8Q+w8K/lOWvIr4w7ff/R0MRLXoxwBkdQcKshCfk73eZVu9pSxjjs= 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:Cc: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; b=caEwVdhFb/DzuJugWT3B5zyY9cvwF8/Hn9aXsA091cBWclJ6xh5hO7Y59FcInr 4YdNIN2/kmJgEexJ0SN3Px8q60R/XXwbCJOFgzm6fxurD67dpkrgSEzDNCxqqzT4 XouBgkPAXWE9q+BmnwOcvwpjG4/ozvgaGgM0ncK5mGq6M=; Received: (qmail 8680 invoked by alias); 15 May 2012 10:22:52 -0000 Received: (qmail 8636 invoked by uid 22791); 15 May 2012 10:22:50 -0000 X-SWARE-Spam-Status: No, hits=-3.5 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 15 May 2012 10:22:35 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id E51C91C6DF3; Tue, 15 May 2012 06:22:34 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Rir9iUPXFvWK; Tue, 15 May 2012 06:22:34 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 605531C6D52; Tue, 15 May 2012 06:22:33 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4192) id 6072792BF6; Tue, 15 May 2012 06:22:33 -0400 (EDT) Date: Tue, 15 May 2012 06:22:33 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Tristan Gingold Subject: [Ada] Save occurrence on the stack before calling last chance handler Message-ID: <20120515102233.GA13595@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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 The occurrence was already saved but in dynamically allocated memory. This patch saves it on the stack to avoid the allocation, which useful in case of Storage_Error. No functional change in normal conditions. Tested on x86_64-pc-linux-gnu, committed on trunk 2012-05-15 Tristan Gingold * a-exextr.adb (Unhandled_Exception_Terminate): Save occurrence on the stack to avoid a dynamic memory allocation. Index: a-exextr.adb =================================================================== --- a-exextr.adb (revision 187501) +++ a-exextr.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -162,14 +162,15 @@ ----------------------------------- procedure Unhandled_Exception_Terminate is - Excep : constant EOA := Save_Occurrence (Get_Current_Excep.all.all); + Excep : Exception_Occurrence; -- This occurrence will be used to display a message after finalization. -- It is necessary to save a copy here, or else the designated value -- could be overwritten if an exception is raised during finalization -- (even if that exception is caught). begin - Last_Chance_Handler (Excep.all); + Save_Occurrence (Excep, Get_Current_Excep.all.all); + Last_Chance_Handler (Excep); end Unhandled_Exception_Terminate; ------------------------------------