From patchwork Mon May 6 18:52:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 241757 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 99BFE2C00A6 for ; Tue, 7 May 2013 04:53:03 +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=LqcIzUJrpLC+VuNbZG5nAhTceIhze 1/vaJoQ6rwB8YBC/6PUlw+Dc46t6dZtKrAmkPPNN97pWmcphND9hmIXA4Cbi9LUo XVjRetom/UJzvuqU1qsR8weDTBi9ojh+8UdPWnOvZasIMohcnh5WIhZEsAYecqj6 9jEiOO4biqeyLM= 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=WQfU0joSnKk/F5ruzgE494TOnvc=; b=duJ 1b3TykQpv8wt7QlR0iWppClJuXk7musw+uBql6m7hbkYmP3Zq2uzXDJbhhHAjqOg wxYY/XKz53K7kRaQ6gzI/BbN/7MhnuTzIt4STJrCKbo8N5JuemKKv6KBrf5SPMIU uiGG1B7+9gcfROZDQLhaA99mpVcJbQseBrbuBKz8= Received: (qmail 11429 invoked by alias); 6 May 2013 18:52:57 -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 11417 invoked by uid 89); 6 May 2013 18:52:57 -0000 X-Spam-SWARE-Status: No, score=-7.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 06 May 2013 18:52:56 +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 r46IqtEc010539 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 6 May 2013 14:52:55 -0400 Received: from zalov.cz (vpn-57-147.rdu2.redhat.com [10.10.57.147]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r46IqrY6007962 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 6 May 2013 14:52:55 -0400 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.cz (8.14.5/8.14.5) with ESMTP id r46Iqqhh004036; Mon, 6 May 2013 20:52:52 +0200 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id r46Iqonm004035; Mon, 6 May 2013 20:52:50 +0200 Date: Mon, 6 May 2013 20:52:49 +0200 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix -g ICE with COMPOUND_LITERAL_EXPR (PR debug/57184) Message-ID: <20130506185249.GN28963@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Hi! We ICE on the following testcase, because DECL_INITIAL contains COMPOUND_LITERAL_EXPR, which expr.c assumes has been gimplified, but initializers aren't gimplified. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk/4.8? 2013-05-06 Jakub Jelinek PR debug/57184 * expr.c (expand_expr_addr_expr_1): Handle COMPOUND_LITERAL_EXPR for modifier == EXPAND_INITIALIZER. * gcc.dg/pr57184.c: New test. Jakub --- gcc/expr.c.jj 2013-05-03 14:55:04.000000000 +0200 +++ gcc/expr.c 2013-05-06 13:41:03.274302405 +0200 @@ -7561,6 +7561,15 @@ expand_expr_addr_expr_1 (tree exp, rtx t inner = TREE_OPERAND (exp, 0); break; + case COMPOUND_LITERAL_EXPR: + /* Allow COMPOUND_LITERAL_EXPR in initializers, if e.g. + rtl_for_decl_init is called on DECL_INITIAL with + COMPOUNT_LITERAL_EXPRs in it, they aren't gimplified. */ + if (modifier == EXPAND_INITIALIZER + && COMPOUND_LITERAL_EXPR_DECL (exp)) + return expand_expr_addr_expr_1 (COMPOUND_LITERAL_EXPR_DECL (exp), + target, tmode, modifier, as); + /* FALLTHRU */ default: /* If the object is a DECL, then expand it for its rtl. Don't bypass expand_expr, as that can have various side effects; LABEL_DECLs for --- gcc/testsuite/gcc.dg/pr57184.c.jj 2013-05-06 13:42:12.514923650 +0200 +++ gcc/testsuite/gcc.dg/pr57184.c 2013-05-06 13:41:55.000000000 +0200 @@ -0,0 +1,13 @@ +/* PR debug/57184 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -g" } */ + +struct S {}; +void bar (struct S *const); +static struct S *const c = &(struct S) {}; + +void +foo (void) +{ + bar (c); +}