From patchwork Tue Jul 3 08:04:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 168728 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 B3A4A2C00F5 for ; Tue, 3 Jul 2012 18:05:18 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1341907520; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=WKoF7CaOD8osJh9OrmJx ARnKEvo=; b=o0ZEy/QjbnxSo/eONbSRdFKQyEmRniK+p21AdGu4PtLwkpY/2mSM NxfD9rqm0HKL8VDroA0OOYrSGu7stFu95/qviRZyDQlIJFUfmEj0PF0Vy5/aco8l mSqqb6kiB9EdOPl36AYdQOIEk5/TkWXqr/vRRJhAY1tEQ+HplXYznUI= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=dkxnY+3NgsV2Sn1GLg0lDcuWaSNYcci+OhFMn92Zug2XkBGfiAwSuOnlImF31I /qlEinBzX+ry0NNWbLl78nuwM/htzx5Ep+WAUUPz9u36EdZAWt7oI18DIj5USCAp lw9jzC1U3bNIdyFFtMWxCa0xnq0klqpZTHV910Od+pqOk=; Received: (qmail 20117 invoked by alias); 3 Jul 2012 08:05:09 -0000 Received: (qmail 20103 invoked by uid 22791); 3 Jul 2012 08:05:08 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, SPF_HELO_PASS 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; Tue, 03 Jul 2012 08:04:53 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6384rYJ013965 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 3 Jul 2012 04:04:54 -0400 Received: from zalov.redhat.com (vpn1-4-181.ams2.redhat.com [10.36.4.181]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q6384pMH007502 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 3 Jul 2012 04:04:52 -0400 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.redhat.com (8.14.5/8.14.5) with ESMTP id q6384ngw005261; Tue, 3 Jul 2012 10:04:49 +0200 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id q6384nDD005260; Tue, 3 Jul 2012 10:04:49 +0200 Date: Tue, 3 Jul 2012 10:04:48 +0200 From: Jakub Jelinek To: Jason Merrill Cc: gcc-patches@gcc.gnu.org Subject: [C++ PATCH] Fix ICE with computed goto (PR c++/53812) Message-ID: <20120703080448.GI20264@tucnak.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! We ICE on this testcase since forever, because the computed goto's operand needs cleanups and doesn't have corresponding CLEANUP_POINT_EXPR emitted anywhere. Given that the operand is void * and only valid values for it are && LABEL_DECLs, I think it is ok to perform the cleanups before the actual goto. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2012-07-03 Jakub Jelinek PR c++/53812 * semantics.c (finish_goto_stmt): Surround computed goto argument with CLEANUP_POINT_EXPR if needed. * g++.dg/ext/label14.C: New test. Jakub --- gcc/cp/semantics.c.jj 2012-06-27 16:36:03.000000000 +0200 +++ gcc/cp/semantics.c 2012-07-02 10:22:26.377925168 +0200 @@ -571,6 +571,9 @@ finish_goto_stmt (tree destination) tf_warning_or_error); if (error_operand_p (destination)) return NULL_TREE; + destination + = fold_build_cleanup_point_expr (TREE_TYPE (destination), + destination); } } --- gcc/testsuite/g++.dg/ext/label14.C.jj 2012-07-02 10:28:14.305949165 +0200 +++ gcc/testsuite/g++.dg/ext/label14.C 2012-07-02 10:27:11.000000000 +0200 @@ -0,0 +1,17 @@ +// PR c++/53812 +// { dg-do compile } +// { dg-options "" } + +struct T { T () : t(0) {}; int t; ~T (); }; +struct S { void *operator [] (T); }; +void bar (S &, void *, void *); + +void +foo (S &x, T &y) +{ + bar (x, &&l1, &&l2); +l1: + goto *x[y]; +l2: + bar (x, &&l1, &&l2); +}