From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30461 invoked by alias); 11 Jun 2011 16:06:08 -0000 Received: (qmail 30451 invoked by uid 22791); 11 Jun 2011 16:06:06 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,NO_DNS_FOR_FROM,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mga09.intel.com (HELO mga09.intel.com) (134.134.136.24) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 11 Jun 2011 16:05:52 +0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 11 Jun 2011 09:05:52 -0700 X-ExtLoop1: 1 Received: from gnu-6.sc.intel.com ([10.3.194.135]) by orsmga001.jf.intel.com with ESMTP; 11 Jun 2011 09:05:51 -0700 Received: by gnu-6.sc.intel.com (Postfix, from userid 500) id 87A65C2266; Sat, 11 Jun 2011 09:05:48 -0700 (PDT) Date: Sat, 11 Jun 2011 16:22:00 -0000 From: "H.J. Lu" To: gcc-patches@gcc.gnu.org Subject: PATCH [5/n]: Prepare x32: PR middle-end/48016: Inconsistency in non-local goto save area Message-ID: <20110611160548.GA20036@intel.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-06/txt/msg00919.txt.bz2 Hi, We are very inconsistent when saving and restoring non-local goto save area. See: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48016 for detailed analysis. OK for trunk? Thanks. H.J. --- 2011-06-07 H.J. Lu PR middle-end/48016 * explow.c (emit_stack_save): Adjust mode of stack save area. * function.c (expand_function_start): Properly store frame pointer for non-local goto. diff --git a/gcc/explow.c b/gcc/explow.c index 7387dad..b343bf8 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -1035,6 +1030,14 @@ emit_stack_save (enum save_level save_level, rtx *psave) do_pending_stack_adjust (); if (sa != 0) sa = validize_mem (sa); + /* FIXME: update_nonlocal_goto_save_area may pass SA in the wrong mode. */ + if (GET_MODE (sa) != mode) + { + gcc_assert (ptr_mode != Pmode + && GET_MODE (sa) == ptr_mode + && mode == Pmode); + sa = adjust_address (sa, mode, 0); + } emit_insn (fcn (sa, stack_pointer_rtx)); } diff --git a/gcc/function.c b/gcc/function.c index 30cc9ff..47fd5b7 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -4779,7 +4779,7 @@ expand_function_start (tree subr) cfun->nonlocal_goto_save_area, integer_zero_node, NULL_TREE, NULL_TREE); r_save = expand_expr (t_save, NULL_RTX, VOIDmode, EXPAND_WRITE); - r_save = convert_memory_address (Pmode, r_save); + r_save = adjust_address (r_save, Pmode, 0); emit_move_insn (r_save, targetm.builtin_setjmp_frame_value ()); update_nonlocal_goto_save_area ();