From patchwork Tue Oct 7 12:55:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Palachev X-Patchwork-Id: 397289 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 28D321400A3 for ; Tue, 7 Oct 2014 23:55:32 +1100 (EST) 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:cc:subject:content-type; q=dns; s=default; b=ouGSQrqCO391QSa0jQabRX0O2B1FflftLAWmI021SNQ cJmQ6I4vix61bsSa9i+JTUwQIleKVD4P4MdMO1weMqxg8TvpxcnE/+5JP1sLEo80 qd9E6TCcZfxAhXxw18pyx1wLzBl4A3Jzk01BnrrcDfw/J5OKqjimzbU2vF4c+q0w = 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:cc:subject:content-type; s=default; bh=6gCvDi0xUj6TxwmX9+u4RkdhjWs=; b=cxmMHoY7tz1ZC+d/k WgBCPz7FqamgjTA2Ilq7hY4NJpyJDv534Hnz45KGkPDeWquecrDwCg/SIzKz7+sw 9Bjwtj3Bj+YcO6aZHhCgM4NV0/3oN+IofEZzXIt7nnJhkhq2QjzNYeqZyAst7LCV 8RcD9vt4PuYhpHiUkzua5ysDhc= Received: (qmail 4611 invoked by alias); 7 Oct 2014 12:55:26 -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 4599 invoked by uid 89); 7 Oct 2014 12:55:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.2 required=5.0 tests=AWL, BAYES_00, HDRS_LCASE, SPF_HELO_PASS, T_MANY_HDRS_LCASE, T_RP_MATCHES_RCVD, URIBL_RHS_DOB autolearn=no version=3.3.2 X-HELO: mailout3.w1.samsung.com Received: from mailout3.w1.samsung.com (HELO mailout3.w1.samsung.com) (210.118.77.13) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (DES-CBC3-SHA encrypted) ESMTPS; Tue, 07 Oct 2014 12:55:23 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0ND200BXRS0Z3800@mailout3.w1.samsung.com> for gcc-patches@gcc.gnu.org; Tue, 07 Oct 2014 13:58:11 +0100 (BST) Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 3B.1A.25543.7B2E3345; Tue, 07 Oct 2014 13:55:19 +0100 (BST) Received: from [106.109.129.100] by eusync2.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0ND200B8JRW7M220@eusync2.samsung.com>; Tue, 07 Oct 2014 13:55:19 +0100 (BST) Message-id: <5433E2B7.9020401@samsung.com> Date: Tue, 07 Oct 2014 16:55:19 +0400 From: Ilya Palachev User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-version: 1.0 To: gcc-patches Cc: Vyacheslav Barinov Subject: [PATCH] PR lto/59441 Add initialization and release of bitmap obstack Content-type: multipart/mixed; boundary=------------020102060404000207000600 X-IsSubscribed: yes Hi all, Attached patch fixes PR lto/59441. The reason of failure was that the default bitmap obstack was released just before the execution of early local passes. The error was found using valgrind. It reported that there were 153 invalid reads and 173 invalid writes into the field of the default bitmap obstack structure, and all of them were trying to access data that was free'd previously (at the same point of the program). The solution is to add initialization and release of the bitmap obstack before and after the execution of early local passes. After applying this patch valgrind does not report any errors for the same testcase. The patch was bootstrapped and regtested on x86_64-unknown-linux-gnu. Ok for trunk? Best regards, Ilya Palachev From 9bf2878c0a74475283b5424f24e46b31feb13cf7 Mon Sep 17 00:00:00 2001 From: Ilya Palachev Date: Tue, 7 Oct 2014 16:09:25 +0400 Subject: [PATCH] Add initialization and release of bitmap obstack gcc/ 2014-10-07 Ilya Palachev * cgraphunit.c (process_new_functions): Add initialization and release of bitmap obstack before and after running of passes. gcc/testsuite/ 2014-10-07 Ilya Palachev * g++.dg/lto/pr59441_0.C: New test from bugzilla. --- gcc/cgraphunit.c | 6 +++++- gcc/testsuite/g++.dg/lto/pr59441_0.C | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/lto/pr59441_0.C diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index d463505..ee42ad1 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -323,7 +323,11 @@ symbol_table::process_new_functions (void) push_cfun (DECL_STRUCT_FUNCTION (fndecl)); if (state == IPA_SSA && !gimple_in_ssa_p (DECL_STRUCT_FUNCTION (fndecl))) - g->get_passes ()->execute_early_local_passes (); + { + bitmap_obstack_initialize (NULL); + g->get_passes ()->execute_early_local_passes (); + bitmap_obstack_release (NULL); + } else if (inline_summary_vec != NULL) compute_inline_parameters (node, true); free_dominance_info (CDI_POST_DOMINATORS); diff --git a/gcc/testsuite/g++.dg/lto/pr59441_0.C b/gcc/testsuite/g++.dg/lto/pr59441_0.C new file mode 100644 index 0000000..3c766e5 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr59441_0.C @@ -0,0 +1,26 @@ +// { dg-lto-do assemble } +// { dg-lto-options { { -shared -fPIC -flto -O -fvtable-verify=std } } } + +template < typename T > struct A +{ + T foo (); +}; + +template < typename T > struct C: virtual public A < T > +{ + C & operator<< (C & (C &)); +}; + +template < typename T > +C < T > &endl (C < int > &c) +{ + c.foo (); + return c; +} + +C < int > cout; +void +fn () +{ + cout << endl; +} -- 2.1.1