From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 103311 invoked by alias); 21 Dec 2015 15:16:29 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 103204 invoked by uid 89); 21 Dec 2015 15:16:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.3 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=lto-symtab, ltosymtab, conclude, gimple_bb X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 21 Dec 2015 15:16:28 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id EAEAB2EE0030; Mon, 21 Dec 2015 16:16:24 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id z_upIypx5AWf; Mon, 21 Dec 2015 16:16:24 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id C2F612EE0028; Mon, 21 Dec 2015 16:16:24 +0100 (CET) From: Eric Botcazou To: Jan Hubicka Cc: gcc-patches@gcc.gnu.org, "H.J. Lu" , Richard Biener , Arnaud Charlet Subject: Re: Fix lto-symtab ICE during Ada LTO bootstrap Date: Mon, 21 Dec 2015 15:16:00 -0000 Message-ID: <2335219.HdMfxlLlst@polaris> User-Agent: KMail/4.14.9 (Linux/3.16.7-29-desktop; KDE/4.14.9; x86_64; ; ) In-Reply-To: <20151221141944.GB10803@kam.mff.cuni.cz> References: <20151121182122.GB23225@kam.mff.cuni.cz> <3448714.nhJ8om10cS@polaris> <20151221141944.GB10803@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart2927707.vz9PDWvdtz" Content-Transfer-Encoding: 7Bit X-SW-Source: 2015-12/txt/msg01989.txt.bz2 This is a multi-part message in MIME format. --nextPart2927707.vz9PDWvdtz Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Content-length: 2530 > I suppose the CFG verifier should also catch this. I wonder how this can > lead to wrong code as opossed to infinite loop? > I can imagine DCE being confused about non-control-flow stmt and conclude > the abnormal path as the path leaving the loop. I will look into the > testcase more. : # DEBUG id => e_186 _11422 = atree__unchecked_access__node4.localalias.3007 (e_186); : # DEBUG id => NULL # DEBUG n => _11422 # DEBUG n => NULL if (_11422 == 0) goto (); else goto ; The next block is: : # DEBUG id => e_186 goto ; and has the stalled ABNORMAL flag. This causes the latch edge to be split. When the PHI node consuming _11422 is processed: processing: e_186 = PHI the following code is invoked: if (aggressive && !degenerate_phi_p (stmt)) { for (k = 0; k < gimple_phi_num_args (stmt); k++) { basic_block arg_bb = gimple_phi_arg_edge (phi, k)->src; if (gimple_bb (stmt) != get_immediate_dominator (CDI_POST_DOMINATORS, arg_bb)) { if (!bitmap_bit_p (last_stmt_necessary, arg_bb->index)) mark_last_stmt_necessary (arg_bb); } else if (arg_bb != ENTRY_BLOCK_PTR_FOR_FN (cfun) && !bitmap_bit_p (visited_control_parents, arg_bb->index)) mark_control_dependent_edges_necessary (arg_bb, true); } } arg_bb is the immediate postdominator of gimple_bb (stmt) so the first condition is false. And the second condition is also false because arg_bb was already marked in visited_control_parents from: FOR_EACH_LOOP (loop, 0) if (!finite_loop_p (loop)) { if (dump_file) fprintf (dump_file, "can not prove finiteness of loop %i\n", loop->num); mark_control_dependent_edges_necessary (loop->latch, false); } I'm not quite sure where the logic goes wrong, but the comment just above the first quoted block of code makes one think it is a bit fragile. In any case, the fixlet I posted was slightly off, so here is the patch I have installed as obvious after testing on x86-64/Linux. PR tree-optimization/65337 * tree-ssa-pre.c (eliminate): Also clean up abnormal edges if need be. -- Eric Botcazou --nextPart2927707.vz9PDWvdtz Content-Disposition: attachment; filename="p.diff" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="utf-8"; name="p.diff" Content-length: 471 Index: tree-ssa-pre.c =================================================================== --- tree-ssa-pre.c (revision 231856) +++ tree-ssa-pre.c (working copy) @@ -4499,6 +4499,8 @@ eliminate (bool do_pre) unlink_stmt_vdef (stmt); if (gsi_remove (&gsi, true)) bitmap_set_bit (need_eh_cleanup, bb->index); + if (is_gimple_call (stmt) && stmt_can_make_abnormal_goto (stmt)) + bitmap_set_bit (need_ab_cleanup, bb->index); release_defs (stmt); } --nextPart2927707.vz9PDWvdtz--