From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 57415 invoked by alias); 12 Apr 2015 19:08:44 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 57404 invoked by uid 89); 12 Apr 2015 19:08:43 -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,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD 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; Sun, 12 Apr 2015 19:08:42 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 979EB8E3C6; Sun, 12 Apr 2015 19:08:40 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-24.ams2.redhat.com [10.36.116.24]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3CJ8cL6021763 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 12 Apr 2015 15:08:39 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.9/8.14.9) with ESMTP id t3CJ8a35000966; Sun, 12 Apr 2015 21:08:36 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.9/8.14.9/Submit) id t3CJ8Y51000965; Sun, 12 Apr 2015 21:08:34 +0200 Date: Sun, 12 Apr 2015 19:08:00 -0000 From: Jakub Jelinek To: Jan Hubicka , Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix ICF ICE (PR tree-optimization/65747) Message-ID: <20150412190834.GB1735@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg00529.txt.bz2 Hi! On the following testcase, ICF assumes OBJ_TYPE_REF_OBJECT must be a SSA_NAME, but that is not the case in the testcase, where it is ADDR_EXPR of MEM_REF instead. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2015-04-12 Jakub Jelinek PR tree-optimization/65747 * ipa-icf-gimple.c (func_checker::compare_operand): Use compare_operand rather than compare_ssa_name for OBJ_TYPE_REF_OBJECT. * g++.dg/torture/pr65747.C: New test. --- gcc/ipa-icf-gimple.c.jj 2015-03-14 09:49:39.000000000 +0100 +++ gcc/ipa-icf-gimple.c 2015-04-12 17:12:37.093411034 +0200 @@ -521,8 +521,8 @@ func_checker::compare_operand (tree t1, if (!types_same_for_odr (obj_type_ref_class (t1), obj_type_ref_class (t2))) return return_false_with_msg ("OBJ_TYPE_REF OTR type mismatch"); - if (!compare_ssa_name (OBJ_TYPE_REF_OBJECT (t1), - OBJ_TYPE_REF_OBJECT (t2))) + if (!compare_operand (OBJ_TYPE_REF_OBJECT (t1), + OBJ_TYPE_REF_OBJECT (t2))) return return_false_with_msg ("OBJ_TYPE_REF object mismatch"); } --- gcc/testsuite/g++.dg/torture/pr65747.C.jj 2015-04-12 17:09:15.302632192 +0200 +++ gcc/testsuite/g++.dg/torture/pr65747.C 2015-04-12 17:11:39.003338317 +0200 @@ -0,0 +1,48 @@ +// PR tree-optimization/65747 +// { dg-do compile } + +struct A {}; +struct E { + virtual A m2(); +} *a; +struct B { + char b[sizeof (E)]; + void m1(); +}; +struct C { + B c; + void m3() { c.m1(); } + friend class D; +}; +struct D { + int m4(C); + void m5(); + void m6(int, C); + void m7(int, C); + void m8(); + bool m9(); + void m10(int); + void m11(int); +}; +void B::m1() { a = (E *)b; a->m2(); } +void D::m10(int) { m8(); } +void D::m11(int) { m8(); } +int D::m4(C p1) { p1.m3(); return 0; } +void D::m6(int, C p2) { + int b = 0; + if (m9()) { + m4(p2); + m10(b); + } else + m5(); + m10(int()); +} +void D::m7(int, C p2) { + int c = 0; + if (m9()) { + m4(p2); + m11(c); + } else + m5(); + m11(int()); +} Jakub