From patchwork Thu Dec 8 12:31:01 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 130157 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 B5AD11007D7 for ; Thu, 8 Dec 2011 23:31:23 +1100 (EST) Received: (qmail 24915 invoked by alias); 8 Dec 2011 12:31:17 -0000 Received: (qmail 24903 invoked by uid 22791); 8 Dec 2011 12:31:16 -0000 X-SWARE-Spam-Status: No, hits=-3.8 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, TW_CX X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 08 Dec 2011 12:31:02 +0000 Received: from relay1.suse.de (nat.nue.novell.com [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 448948980B for ; Thu, 8 Dec 2011 13:31:01 +0100 (CET) Date: Thu, 8 Dec 2011 13:31:01 +0100 (CET) From: Richard Guenther To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR50747 Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 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 The asserts added in rev. 179429 are too strict as shown by the testcases in PR50747 (triggering both asserts individually). The following patch simply removes them instead of trying to massage it. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2011-12-08 Richard Guenther PR lto/50747 * lto-streamer-out.c (produce_symtab): Remove asserts. * g++.dg/opt/pr50747-1_0.C: New testcase. * g++.dg/opt/pr50747-2_0.C: Likewise. Index: gcc/lto-streamer-out.c =================================================================== --- gcc/lto-streamer-out.c (revision 182107) +++ gcc/lto-streamer-out.c (working copy) @@ -1450,11 +1450,7 @@ produce_symtab (struct output_block *ob, them indirectly or via vtables. Do not output them to symbol table: they end up being undefined and just consume space. */ if (!node->address_taken && !node->callers) - { - gcc_assert (node->analyzed); - gcc_assert (DECL_DECLARED_INLINE_P (node->decl)); - continue; - } + continue; if (DECL_COMDAT (node->decl) && cgraph_comdat_can_be_unshared_p (node)) continue; Index: gcc/testsuite/g++.dg/opt/pr50747-1_0.C =================================================================== --- gcc/testsuite/g++.dg/opt/pr50747-1_0.C (revision 0) +++ gcc/testsuite/g++.dg/opt/pr50747-1_0.C (revision 0) @@ -0,0 +1,18 @@ +// { dg-do compile } +// { dg-require-effective-target lto } +// { dg-options "-flto" } + +void foo(); + +static void bar() __attribute__((weakref("foo"))); + +struct A +{ + A(); +}; + +int i; + +template struct B : T {}; + +B b; Index: gcc/testsuite/g++.dg/opt/pr50747-2_0.C =================================================================== --- gcc/testsuite/g++.dg/opt/pr50747-2_0.C (revision 0) +++ gcc/testsuite/g++.dg/opt/pr50747-2_0.C (revision 0) @@ -0,0 +1,112 @@ +// { dg-do compile } +// { dg-require-effective-target lto } +// { dg-options "-w -fpermissive -fno-implicit-templates -flto" } + +namespace std { + typedef long unsigned int size_t; + template class allocator; + template struct char_traits; + template > class basic_ostream; + template, typename _Alloc = allocator<_CharT> > class basic_ostringstream; +} +extern "C++" { + namespace std { + class exception { + }; + }; +} +namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { + template class new_allocator { + }; +} +namespace std __attribute__ ((__visibility__ ("default"))) { + template class allocator: public __gnu_cxx::new_allocator<_Tp> { + public: typedef size_t size_type; + template struct rebind { + typedef allocator<_Tp1> other; + }; + }; + template class basic_string { + typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type; + typedef typename _CharT_alloc_type::size_type size_type; + private: struct _Rep_base { + }; + struct _Rep : _Rep_base { + _CharT* _M_refdata() throw() { + } + }; + struct _Alloc_hider : _Alloc { + _Alloc_hider(_CharT* __dat, const _Alloc& __a) : _Alloc(__a), _M_p(__dat) { + } + _CharT* _M_p; + }; + private: mutable _Alloc_hider _M_dataplus; + static _Rep& _S_empty_rep() { + } + public: basic_string() : _M_dataplus(_S_empty_rep()._M_refdata(), _Alloc()) { + } + template basic_string(_InputIterator __beg, _InputIterator __end, const _Alloc& __a = _Alloc()); + static _CharT* _S_construct(size_type __req, _CharT __c, const _Alloc& __a); + }; + template inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const basic_string<_CharT, _Traits, _Alloc>& __str) { + } + template template basic_string<_CharT, _Traits, _Alloc>:: basic_string(_InputIterator __beg, _InputIterator __end, const _Alloc& __a) : _M_dataplus(_S_construct(__beg, __end, __a), __a) { + }; + enum _Ios_Openmode { + _S_app = 1L << 0, _S_ate = 1L << 1, _S_bin = 1L << 2, _S_in = 1L << 3, _S_out = 1L << 4, _S_trunc = 1L << 5, _S_ios_openmode_end = 1L << 16 }; + class ios_base { + public: class failure : public exception { + }; + typedef _Ios_Openmode openmode; + static const openmode in = _S_in; + static const openmode out = _S_out; + }; + template class basic_streambuf { + public: typedef _CharT char_type; + char_type* egptr() const { + } + char_type* pbase() const { + } + char_type* pptr() const { + } + }; + template class basic_ios : public ios_base { + }; + template class basic_ostream : virtual public basic_ios<_CharT, _Traits> { + }; + template class basic_stringbuf : public basic_streambuf<_CharT, _Traits> { + public: typedef _CharT char_type; + typedef _Traits traits_type; + typedef basic_streambuf __streambuf_type; + typedef basic_string __string_type; + protected: ios_base::openmode _M_mode; + __string_type _M_string; + public: explicit basic_stringbuf(ios_base::openmode __mode = ios_base::in | ios_base::out) : __streambuf_type(), _M_mode(__mode), _M_string() { + } + __string_type str() const { + __string_type __ret; + if (this->pptr()) { + if (this->pptr() > this->egptr()) __ret = __string_type(this->pbase(), this->pptr()); + } + } + }; + template class basic_ostringstream : public basic_ostream<_CharT, _Traits> { + public: typedef _CharT char_type; + typedef _Traits traits_type; + typedef basic_string<_CharT, _Traits, _Alloc> __string_type; + typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type; + typedef basic_ostream __ostream_type; + private: __stringbuf_type _M_stringbuf; + public: explicit basic_ostringstream(ios_base::openmode __mode = ios_base::out) : __ostream_type(), _M_stringbuf(__mode | ios_base::out) { + } + __string_type str() const { + return _M_stringbuf.str(); + } + }; + template class complex; + template basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x) { + basic_ostringstream<_CharT, _Traits> __s; + return __os << __s.str(); + }; + template basic_ostream >& operator<<(basic_ostream >&, const complex&); +}