From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 44224 invoked by alias); 17 May 2017 02:12:26 -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 44059 invoked by uid 89); 17 May 2017 02:12:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: one.firstfloor.org Received: from one.firstfloor.org (HELO one.firstfloor.org) (193.170.194.197) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 17 May 2017 02:12:23 +0000 Received: from firstfloor.org (67-5-219-155.ptld.qwest.net [67.5.219.155]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by one.firstfloor.org (Postfix) with ESMTPSA id 4B36D86A95; Wed, 17 May 2017 04:12:22 +0200 (CEST) Received: by firstfloor.org (Postfix, from userid 1000) id 2EFA7A3288; Tue, 16 May 2017 19:12:20 -0700 (PDT) From: Andi Kleen To: gcc-patches@gcc.gnu.org Cc: Andi Kleen Subject: [PATCH] Dump functions for verification failures Date: Wed, 17 May 2017 02:14:00 -0000 Message-Id: <20170517021216.8236-1-andi@firstfloor.org> X-SW-Source: 2017-05/txt/msg01338.txt.bz2 From: Andi Kleen When a verification check fails it is useful to dump the current function to the dump file, so it's easier to figure out what actually went wrong. Add function dumps for gimple or SSA verification failures. Suggested by Jakub. Passes bootstrap and testing on x86_64-linux gcc/: 2017-05-16 Andi Kleen * tree-cfg.c (verify_gimple_in_cfg): Dump function. * tree-into-ssa.c (update_ssa): Dump function. * tree-outof-ssa.c (eliminate_useless_phis): Dump function. (rewrite_trees): Dump function. --- gcc/tree-cfg.c | 6 +++++- gcc/tree-into-ssa.c | 2 ++ gcc/tree-outof-ssa.c | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 7dbd0a8c247..05073906fbd 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -5279,7 +5279,11 @@ verify_gimple_in_cfg (struct function *fn, bool verify_nothrow) (&visited_stmts); if (err || eh_error_found) - internal_error ("verify_gimple failed"); + { + if (dump_file) + dump_function_to_file (fn->decl, dump_file, dump_flags); + internal_error ("verify_gimple failed"); + } verify_histograms (); timevar_pop (TV_TREE_STMT_VERIFY); diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c index d4056373f31..de150b8e917 100644 --- a/gcc/tree-into-ssa.c +++ b/gcc/tree-into-ssa.c @@ -3387,6 +3387,8 @@ update_ssa (unsigned update_flags) "renaming: "); print_generic_expr (stderr, name, TDF_SLIM); fprintf (stderr, "\n"); + if (dump_file) + dump_function_to_file (cfun->decl, dump_file, dump_flags); internal_error ("SSA corruption"); } } diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c index 0ce6c155bd3..8be0b1088df 100644 --- a/gcc/tree-outof-ssa.c +++ b/gcc/tree-outof-ssa.c @@ -821,6 +821,8 @@ eliminate_useless_phis (void) print_generic_expr (stderr, arg, TDF_SLIM); fprintf (stderr, "), but the result is :"); print_gimple_stmt (stderr, phi, 0, TDF_SLIM); + if (dump_file) + dump_function_to_file (cfun->decl, dump_file, dump_flags); internal_error ("SSA corruption"); } } @@ -880,6 +882,8 @@ rewrite_trees (var_map map) print_generic_expr (stderr, arg, TDF_SLIM); fprintf (stderr, "), but the result is not :"); print_gimple_stmt (stderr, phi, 0, TDF_SLIM); + if (dump_file) + dump_function_to_file (cfun->decl, dump_file, dump_flags); internal_error ("SSA corruption"); } } -- 2.12.2