From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 1F3783857C40 for ; Wed, 7 Oct 2020 06:04:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1F3783857C40 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rguenther@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 0E47DABD1 for ; Wed, 7 Oct 2020 06:04:27 +0000 (UTC) Date: Wed, 7 Oct 2020 08:04:26 +0200 (CEST) From: Richard Biener Sender: rguenther@c653.arch.suse.de To: Tom de Vries cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH][tree-ssa-loop-ch] Add missing NULL test for dump_file In-Reply-To: <20201007055343.GA28730@delia> Message-ID: References: <20201007055343.GA28730@delia> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Oct 2020 06:04:29 -0000 On Wed, 7 Oct 2020, Tom de Vries wrote: > Hi, > > If we change gimple_can_duplicate_bb_p to return false instead of true, we run > into a segfault in ch_base::copy_headers due to using dump_file while it's > NULL: > ... > if (!gimple_duplicate_sese_region (entry, exit, bbs, n_bbs, copied_bbs, > true)) > { > fprintf (dump_file, "Duplication failed.\n"); > continue; > } > ... > > Fix this by adding the missing dump_file != NULL test. > > Tested by rebuilding lto1 and rerunning the failing test-case. > > [ Not committing this as obvious because I'm not sure about the > (dump_flags & TDF_DETAILS) bit. ] > > OK for trunk? OK. Richard. > Thanks, > - Tom > > [tree-ssa-loop-ch] Add missing NULL test for dump_file > > gcc/ChangeLog: > > 2020-10-07 Tom de Vries > > * tree-ssa-loop-ch.c (ch_base::copy_headers): Add missing NULL test > for dump_file. > > --- > gcc/tree-ssa-loop-ch.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c > index b86acf7c39d..1f3d9321a55 100644 > --- a/gcc/tree-ssa-loop-ch.c > +++ b/gcc/tree-ssa-loop-ch.c > @@ -425,7 +425,8 @@ ch_base::copy_headers (function *fun) > if (!gimple_duplicate_sese_region (entry, exit, bbs, n_bbs, copied_bbs, > true)) > { > - fprintf (dump_file, "Duplication failed.\n"); > + if (dump_file && (dump_flags & TDF_DETAILS)) > + fprintf (dump_file, "Duplication failed.\n"); > continue; > } > copied.safe_push (std::make_pair (entry, loop)); > -- Richard Biener SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany; GF: Felix Imend