From patchwork Tue Oct 19 10:24:14 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 68300 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 193DEB70E0 for ; Tue, 19 Oct 2010 21:24:26 +1100 (EST) Received: (qmail 32557 invoked by alias); 19 Oct 2010 10:24:24 -0000 Received: (qmail 32547 invoked by uid 22791); 19 Oct 2010 10:24:24 -0000 X-SWARE-Spam-Status: No, hits=-0.6 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 19 Oct 2010 10:24:17 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 405ECCB02D6; Tue, 19 Oct 2010 12:24:15 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RhxbFwqwAxei; Tue, 19 Oct 2010 12:24:15 +0200 (CEST) Received: from saumur.act-europe.fr (saumur.act-europe.fr [10.10.0.183]) by mel.act-europe.fr (Postfix) with ESMTP id 29657CB0286; Tue, 19 Oct 2010 12:24:15 +0200 (CEST) Received: by saumur.act-europe.fr (Postfix, from userid 525) id 039DDD9BB5; Tue, 19 Oct 2010 12:24:14 +0200 (CEST) Date: Tue, 19 Oct 2010 12:24:14 +0200 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Tristan Gingold Subject: [Ada] Adjust PC only for SS$_HPARITH on Alpha/VMS Message-ID: <20101019102414.GA14715@adacore.com> Mime-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.9i 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 Manually tested on alpha-openvms, Tested on x86_64-pc-linux-gnu, committed on trunk 2010-10-19 Tristan Gingold * init.c: On Alpha/VMS, only adjust PC for HPARITH. Index: init.c =================================================================== --- init.c (revision 165687) +++ init.c (working copy) @@ -1396,13 +1396,13 @@ __gnat_handle_vms_condition (int *sigarg exception = &storage_error; msg = "stack overflow (or erroneous memory access)"; } - __gnat_adjust_context_for_raise (0, (void *)mechargs); + __gnat_adjust_context_for_raise (SS$_ACCVIO, (void *)mechargs); break; case SS$_STKOVF: exception = &storage_error; msg = "stack overflow"; - __gnat_adjust_context_for_raise (0, (void *)mechargs); + __gnat_adjust_context_for_raise (SS$_STKOVF, (void *)mechargs); break; case SS$_HPARITH: @@ -1411,11 +1411,7 @@ __gnat_handle_vms_condition (int *sigarg #else exception = &constraint_error; msg = "arithmetic error"; -#ifndef __alpha__ - /* No need to adjust pc on Alpha: the pc is already on the instruction - after the trapping one. */ - __gnat_adjust_context_for_raise (0, (void *)mechargs); -#endif + __gnat_adjust_context_for_raise (SS$_HPARITH, (void *)mechargs); #endif break; @@ -1491,17 +1487,20 @@ __gnat_install_handler (void) void __gnat_adjust_context_for_raise (int signo ATTRIBUTE_UNUSED, void *ucontext) { - /* Add one to the address of the instruction signaling the condition, - located in the sigargs array. */ + if (signo == SS$_HPARITH) + { + /* Sub one to the address of the instruction signaling the condition, + located in the sigargs array. */ - CHF$MECH_ARRAY * mechargs = (CHF$MECH_ARRAY *) ucontext; - CHF$SIGNAL_ARRAY * sigargs - = (CHF$SIGNAL_ARRAY *) mechargs->chf$q_mch_sig_addr; + CHF$MECH_ARRAY * mechargs = (CHF$MECH_ARRAY *) ucontext; + CHF$SIGNAL_ARRAY * sigargs + = (CHF$SIGNAL_ARRAY *) mechargs->chf$q_mch_sig_addr; - int vcount = sigargs->chf$is_sig_args; - int * pc_slot = & (&sigargs->chf$l_sig_name)[vcount-2]; + int vcount = sigargs->chf$is_sig_args; + int * pc_slot = & (&sigargs->chf$l_sig_name)[vcount-2]; - (*pc_slot) ++; + (*pc_slot)--; + } } #endif