From patchwork Thu Nov 12 15:52:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 543411 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 D6976141409 for ; Fri, 13 Nov 2015 02:52:30 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=hSSNM3zt; 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=E7gITvTTuROUqWohK RQPCA09ggnmDAFsae0I/qehi0P82x8Rtq64XoEBP/Un+59k2AJzo9wvhC0571NeO XDPtIC341hlgtu/uQA5XWR1Euy9geec6cLUYel/vtcDJ8t1v5ebX1bk7x7vFk5uN YxNUhKnBYqcjmR/J1zfchBMizQ= 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=Xl+3IcRVramJL3E5BlHMMt3 6GJY=; b=hSSNM3ztWvLD5Oi6Ru7ksL4lyfG3hTpAqopzmRTJ60ThlDYXBpNWGm+ t1plqNKqwvUuXOxfMvVcgSLctB+58Zvi+L2tzUYmcyU0PkDXAhTj7aeCKWQGHNG9 +Xi8IXELNQwbqTDuvxL7XtOtIiF5Yi9WEiIeun4Bia7t8oa1HtFg= Received: (qmail 1976 invoked by alias); 12 Nov 2015 15:52:22 -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 1959 invoked by uid 89); 12 Nov 2015 15:52:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Thu, 12 Nov 2015 15:52:20 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 75A16ACB9; Thu, 12 Nov 2015 15:51:55 +0000 (UTC) Subject: Re: [PATCH 04/N] Fix big memory leak in ix86_valid_target_attribute_p To: Richard Biener References: <564081EF.7030003@suse.cz> <564463F4.7080003@suse.cz> Cc: GCC Patches , Jakub Jelinek From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Message-ID: <5644B5B0.6040703@suse.cz> Date: Thu, 12 Nov 2015 16:52:16 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: X-IsSubscribed: yes On 11/12/2015 12:29 PM, Richard Biener wrote: > On Thu, Nov 12, 2015 at 11:03 AM, Martin Liška wrote: >> Hello. >> >> Following patch was a bit negotiated with Jakub and can save a huge amount of memory in cases >> where target attributes are heavily utilized. >> >> Can bootstrap and survives regression tests on x86_64-linux-pc. >> >> Ready for trunk? > > +static bool opts_obstack_initialized = false; > + > +/* Initialize opts_obstack if not initialized. */ > + > +void > +init_opts_obstack (void) > +{ > + if (!opts_obstack_initialized) > + { > + opts_obstack_initialized = true; > + gcc_obstack_init (&opts_obstack); > > you can move the static global to function scope. > > Ok with that change. Done and installed as r230264. Final version of the patch is attached. > > Btw, don't other targets need a similar adjustment to their hook? > Grepping shows arm and nios2. nios2 is not the case as it doesn't utilize: init_options_struct (&func_options, NULL); I've been testing patch for aarch64 that is also included in the email. Martin > > Thanks, > Richard. > > >> Thanks, >> Martin From b2a7dcae8de93db470da0b35162f5538337320ee Mon Sep 17 00:00:00 2001 From: marxin Date: Thu, 12 Nov 2015 16:41:16 +0100 Subject: [PATCH] Finalize func_options in arm target in arm_valid_target_attribute_p gcc/ChangeLog: 2015-11-12 Martin Liska * config/arm/arm.c (arm_valid_target_attribute_p): Finalize options struct. --- gcc/config/arm/arm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index f4ebbc8..941774b 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -29956,6 +29956,8 @@ arm_valid_target_attribute_p (tree fndecl, tree ARG_UNUSED (name), DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl) = new_optimize; + finalize_options_struct (&func_options); + return ret; } -- 2.6.2