From patchwork Thu Mar 17 18:40:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 87411 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 7E524B6FDF for ; Fri, 18 Mar 2011 05:40:36 +1100 (EST) Received: (qmail 16698 invoked by alias); 17 Mar 2011 18:40:35 -0000 Received: (qmail 16687 invoked by uid 22791); 17 Mar 2011 18:40:34 -0000 X-SWARE-Spam-Status: No, hits=-5.7 required=5.0 tests=AWL, BAYES_00, KAM_STOCKGEN, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 17 Mar 2011 18:40:26 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p2HIeOBk026285 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 17 Mar 2011 14:40:24 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p2HIeNZV024875 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 17 Mar 2011 14:40:24 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (localhost.localdomain [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id p2HIeNCB022821; Thu, 17 Mar 2011 19:40:23 +0100 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id p2HIeND9022819; Thu, 17 Mar 2011 19:40:23 +0100 Date: Thu, 17 Mar 2011 19:40:23 +0100 From: Jakub Jelinek To: Richard Henderson Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix handling of calls to constants (PR debug/48163) Message-ID: <20110317184023.GV30899@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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 Hi! On calls.c testcase on cris we ICE from prepare_call_arguments on calls like typedef void (*T) (); ((T) 0x100000) (); Calling cselib_lookup with VOIDmode can't do any good, but there is not reason why we should cselib_lookup constants, we can just use them as is. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2011-03-17 Jakub Jelinek PR debug/48163 * var-tracking.c (prepare_call_arguments): If CALL target is a non-SYMBOL_REF CONSTANT_P, just add that into the list as pc instead of looking it up using cselib_lookup and use Pmode for it if x has VOIDmode. * dwarf2out.c (gen_subprogram_die): If also both first and second CONCAT arguments are VOIDmode, use mode of CONCAT itself. Jakub --- gcc/var-tracking.c.jj 2011-03-17 09:37:59.000000000 +0100 +++ gcc/var-tracking.c 2011-03-17 12:45:18.000000000 +0100 @@ -5807,7 +5807,16 @@ prepare_call_arguments (basic_block bb, if (GET_CODE (x) == CALL && MEM_P (XEXP (x, 0))) { x = XEXP (XEXP (x, 0), 0); - if (GET_CODE (x) != SYMBOL_REF) + if (GET_CODE (x) == SYMBOL_REF) + /* Don't record anything. */; + else if (CONSTANT_P (x)) + { + x = gen_rtx_CONCAT (GET_MODE (x) == VOIDmode ? Pmode : GET_MODE (x), + pc_rtx, x); + call_arguments + = gen_rtx_EXPR_LIST (VOIDmode, x, call_arguments); + } + else { cselib_val *val = cselib_lookup (x, GET_MODE (x), 0, VOIDmode); if (val && cselib_preserved_value_p (val)) --- gcc/dwarf2out.c.jj 2011-03-17 12:07:01.000000000 +0100 +++ gcc/dwarf2out.c 2011-03-17 12:54:51.000000000 +0100 @@ -19479,7 +19479,11 @@ gen_subprogram_die (tree decl, dw_die_re == REGNO (XEXP (XEXP (XEXP (next_arg, 0), 0), 0))) next_arg = XEXP (next_arg, 1); if (mode == VOIDmode) - mode = GET_MODE (XEXP (XEXP (arg, 0), 0)); + { + mode = GET_MODE (XEXP (XEXP (arg, 0), 0)); + if (mode == VOIDmode) + mode = GET_MODE (XEXP (arg, 0)); + } if (GET_MODE_CLASS (mode) != MODE_INT || GET_MODE_SIZE (mode) > DWARF2_ADDR_SIZE) continue;