From patchwork Mon Mar 2 18:43:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 445397 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 D7126140140 for ; Tue, 3 Mar 2015 05:43:16 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=YULjQhpl; dkim-adsp=none (unprotected policy); dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=lj4xU1lTSQMtL7TI30/Tj/PlI3/SQQoF23NlbrheOeYXaL o68CIjl/Ql+cXJPnKJWwfE0PZbZYBjJwbATnu4MGPOz9w5xey0rRWBGivkH77tpa 54CLWq123JAL3bBOyJvreBc05E8kgj867xi4n0gY9GKAQjddH15Tt7/CkqM/g= 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 :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=nHUQ16VhsBZsDJceC5FFXWUwv0c=; b=YULjQhplozRfNO9Js2uH f4lM8m3xuHTKC4nBT32xYVOg37rHEb42ZbYahUHfmL5+nXVmRcRE32trtXd7DRM6 BoS4+lAcM+wO6mOyQ6kpX2K6d2R1K7zk22T/sBsNuYjqeJ6fz3rhbUu6P64VGE+I FCnNNNH4f7cfRqMhRWCbqDk= Received: (qmail 75589 invoked by alias); 2 Mar 2015 18:43:09 -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 75573 invoked by uid 89); 2 Mar 2015 18:43:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 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; Mon, 02 Mar 2015 18:43:07 +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 t22Ih6jT017169 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 2 Mar 2015 13:43:06 -0500 Received: from reynosa.quesejoda.com (vpn-49-132.rdu2.redhat.com [10.10.49.132]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t22Ih5he023634; Mon, 2 Mar 2015 13:43:06 -0500 Message-ID: <54F4AF39.6030402@redhat.com> Date: Mon, 02 Mar 2015 10:43:05 -0800 From: Aldy Hernandez User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: gcc-patches , Jan Hubicka Subject: [patch] PR lto/65276 remove odr_violated assert TYPE_BINFO is null when no optimization is used, but odr_violated is unset. Fixed and approved in the PR by Honza. Tested on x86-64 Linux. Committed to mainline. commit a26ff3a2376a898bef8ca8ab17a457052d677a62 Author: Aldy Hernandez Date: Mon Mar 2 09:55:28 2015 -0800 PR lto/65276 * ipa-devirt.c (add_type_duplicate): Remove odr_violated assert when checking TYPE_BINFO. diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index c3f8b15..fe29932 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -1459,7 +1459,6 @@ add_type_duplicate (odr_type val, tree type) && polymorphic_type_binfo_p (TYPE_BINFO (type1)) != polymorphic_type_binfo_p (TYPE_BINFO (type2)))) { - gcc_assert (val->odr_violated); base_mismatch = true; break; } diff --git a/gcc/testsuite/g++.dg/lto/pr65276_0.C b/gcc/testsuite/g++.dg/lto/pr65276_0.C new file mode 100644 index 0000000..c8e9699 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr65276_0.C @@ -0,0 +1,61 @@ +// { dg-lto-do link } +// { dg-lto-options {{-flto -O0 -std=c++11}} } + +/* pr65276_0.C should get compiled with -O0, while the _1.C file + should get compiled with -O2, and the entire thing should be linked + with -O0. Test that we don't get an ICE. */ + +extern "C++" +{ + namespace std + { + class exception + { + public: + virtual ~ exception () noexcept; + }; + } +} +namespace std +{ + struct __cow_string + { + union + { + const char *_M_p; + char _M_bytes[sizeof (const char *)]; + }; + }; + class runtime_error:public exception + { + __cow_string _M_msg; + }; +} +namespace std +{ + class system_error:public std::runtime_error + { + }; + enum _Ios_Fmtflags + { + }; + inline constexpr _Ios_Fmtflags operator& (_Ios_Fmtflags __a, + _Ios_Fmtflags __b) + { + return _Ios_Fmtflags (); + } + enum _Ios_Openmode + { + }; + class ios_base + { + public: + class __attribute ((__abi_tag__ ("cxx11"))) failure:public system_error + { + }; + class Init + { + }; + }; + static ios_base::Init __ioinit; +} diff --git a/gcc/testsuite/g++.dg/lto/pr65276_1.C b/gcc/testsuite/g++.dg/lto/pr65276_1.C new file mode 100644 index 0000000..ee49752 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr65276_1.C @@ -0,0 +1,34 @@ +// { dg-options "-O2" } +#pragma implementation +#pragma interface +extern "C++" +{ + namespace std + { + class exception + { + public: + virtual ~ exception () noexcept; + }; + } +} +namespace std +{ + struct __cow_string + { + union + { + const char *_M_p; + char _M_bytes[sizeof (const char *)]; + }; + }; + class runtime_error:public exception + { + __cow_string _M_msg; + }; +} + +int main() +{ + return 0; +}