From patchwork Wed Oct 8 11:02:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 397609 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 ADB121400B2 for ; Wed, 8 Oct 2014 22:03:02 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=uPxdnjz8jJ3FL/eKnr h6m6V2s1dRTe3rpW7DF4TjZn3kxAagACMdD/YVZSZUuDtC4PNW9ECSuqHOIGiTvO YAeOeOUGGnO2Y2nKql70JCfq2UNS+NvO3wGPHdWTD7m4FykcPvDQgxrmn9uRi0A3 XnvjMrvYR0LJpvgv+/oGmv70E= 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 :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=E+jVMeplg4paebUYY02D0dUs Uy4=; b=GSo3f1rQ/NqmkRvT1cRFqLkDh/Sxbw4SxIuTbOfNFyyoO7NskVSBgaAo h/fM/7lC82LH1qxwzB8UvpLY8meA9bDJwIzHz4OXMheFYyNRHw37AthCaR/NfO8V zG6CC7Pmh+Hv+ZEp9vp+K8kPmkPyolwrWJLq1ZE0cqjjWbXLAIg= Received: (qmail 7515 invoked by alias); 8 Oct 2014 11:02:56 -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 7502 invoked by uid 89); 8 Oct 2014 11:02:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f182.google.com Received: from mail-wi0-f182.google.com (HELO mail-wi0-f182.google.com) (209.85.212.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 08 Oct 2014 11:02:53 +0000 Received: by mail-wi0-f182.google.com with SMTP id n3so10343452wiv.9 for ; Wed, 08 Oct 2014 04:02:50 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.180.19.1 with SMTP id a1mr34766685wie.5.1412766170271; Wed, 08 Oct 2014 04:02:50 -0700 (PDT) Received: by 10.194.20.74 with HTTP; Wed, 8 Oct 2014 04:02:50 -0700 (PDT) In-Reply-To: References: Date: Wed, 8 Oct 2014 13:02:50 +0200 Message-ID: Subject: Re: RFA: Fix debug address mode for TARGET_MEM_REF From: Richard Biener To: Joern Rennecke Cc: GCC Patches , Jim Wilson X-IsSubscribed: yes On Wed, Oct 8, 2014 at 10:16 AM, Joern Rennecke wrote: > Trying to build avr2 strftime of avr-libc ICEs as we are trying to > convert a PSImode address to HImode. There is no reason to > do this conversion in the first place - it is a case of failing to recognize > the proper address space. > > The attached patch fixes this. > > Bootstrapped on i686-pc-linux-gnu. > > OK to apply? The address-space of TARGET_MEM_REFs is in TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (exp, 0))))) see TARGET_MEM_REF expansion or the MEM_REF handling. It's unconditionally there, all the if()s in the existing code are bogus. Thus if (op0 == NULL_RTX) is pre-approved. Thanks, Richard. Index: cfgexpand.c =================================================================== --- cfgexpand.c (revision 215917) +++ cfgexpand.c (working copy) @@ -3286,7 +3286,7 @@ expand_gimple_stmt_1 (gimple stmt) @@ -3983,11 +3983,7 @@ expand_debug_expr (tree exp) if (!op0) return NULL; - if (POINTER_TYPE_P (TREE_TYPE (exp))) - as = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (exp))); - else - as = ADDR_SPACE_GENERIC; - + as = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (exp, 0)))); op0 = convert_debug_memory_address (targetm.addr_space.address_mode (as), op0, as);