From patchwork Wed Oct 1 20:39:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 395670 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 B7DBA14010F for ; Thu, 2 Oct 2014 06:39:46 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=xEpMz6WNO+LwdNk+Erz8UZRf1M955 h9aIBlVXhPZd2STL6X6v029wp1o+HVE1m0+NACVdZTesNZLr8A0zlnrLH4tqnkwF rZqz/LxcLaunFFKAaYvYL5iitjQun32qfpw4wcgFvQDA3Na44NHSz4/XVMjt3KDI vTUw6V55BsWlCA= 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:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=oZzaw5Whf2FCtuYGdxWo/PiwPvE=; b=W6D M9fhaBJdAKw+3xZIx05zyc23bDnM0C5VZJuhNsW6RLRlmRT13sw1Y2iJLJPtWr5j +kzJqB9Yt/Y2D5xQb58rgfU8UqSKX8epdnnFV1OHexFssnsU/DusU3V946pyBhLl rrmkCeHQN/miTVwF1yLK2iKja6f8GS/Ha8ZO4tUo= Received: (qmail 13346 invoked by alias); 1 Oct 2014 20:39:39 -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 13313 invoked by uid 89); 1 Oct 2014 20:39:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 01 Oct 2014 20:39:34 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s91KdXiO004393 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 1 Oct 2014 16:39:33 -0400 Received: from tucnak.zalov.cz (ovpn-116-116.ams2.redhat.com [10.36.116.116]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s91KdVlh021423 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Wed, 1 Oct 2014 16:39:32 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.9/8.14.9) with ESMTP id s91KdTBR019806; Wed, 1 Oct 2014 22:39:30 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.9/8.14.9/Submit) id s91KdRa4019805; Wed, 1 Oct 2014 22:39:27 +0200 Date: Wed, 1 Oct 2014 22:39:27 +0200 From: Jakub Jelinek To: Jason Merrill , Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix dwarf2out ICE (PR debug/63342) Message-ID: <20141001203927.GV1986@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes Hi! Since r214899 we ICE on the following testcase, because when mem_loc_descriptor gives up on a complex TLS related address that can't be (easily) delegitimized, we try to build location description from MEM_EXPR, but in this case it is a TARGET_MEM_REF which wasn't handled. I've implemented more complex handling of TARGET_MEM_REF (attached to the PR), but we really can't handle SSA_NAMEs anyway, and I doubt there will be any usable TARGET_MEM_REFs without SSA_NAMEs in them. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? Ok except for the MEM_REF change for 4.9/4.8 (where the mem_loc_descriptor fix also went)? 2014-10-01 Jakub Jelinek PR debug/63342 * dwarf2out.c (loc_list_from_tree): Handle MEM_REF with non-zero offset, TARGET_MEM_REF and SSA_NAME. * gcc.dg/pr63342.c: New test. Jakub --- gcc/dwarf2out.c.jj 2014-09-25 10:10:26.000000000 +0200 +++ gcc/dwarf2out.c 2014-09-29 16:39:03.847184205 +0200 @@ -14416,15 +14416,21 @@ loc_list_from_tree (tree loc, int want_a break; case MEM_REF: - /* ??? FIXME. */ if (!integer_zerop (TREE_OPERAND (loc, 1))) - return 0; + { + have_address = 1; + goto do_plus; + } /* Fallthru. */ case INDIRECT_REF: list_ret = loc_list_from_tree (TREE_OPERAND (loc, 0), 0); have_address = 1; break; + case TARGET_MEM_REF: + case SSA_NAME: + return NULL; + case COMPOUND_EXPR: return loc_list_from_tree (TREE_OPERAND (loc, 1), want_address); @@ -14587,6 +14593,7 @@ loc_list_from_tree (tree loc, int want_a case POINTER_PLUS_EXPR: case PLUS_EXPR: + do_plus: if (tree_fits_shwi_p (TREE_OPERAND (loc, 1))) { list_ret = loc_list_from_tree (TREE_OPERAND (loc, 0), 0); --- gcc/testsuite/gcc.dg/pr63342.c.jj 2014-09-29 17:02:09.217540570 +0200 +++ gcc/testsuite/gcc.dg/pr63342.c 2014-09-29 17:04:31.797832252 +0200 @@ -0,0 +1,26 @@ +/* PR debug/63342 */ +/* { dg-do compile } */ +/* { dg-options "-g -O2" } */ +/* { dg-additional-options "-fpic" { target fpic } } */ + +static __thread double u[9], v[9]; + +void +foo (double **p, double **q) +{ + *p = u; + *q = v; +} + +double +bar (double x) +{ + int i; + double s = 0.0; + for (i = 0; i < 9; i++) + { + double a = x + v[i]; + s += u[i] * a * a; + } + return s; +}