From patchwork Wed May 17 02:12:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Kleen X-Patchwork-Id: 763305 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 3wSHsC1g00z9s4q for ; Wed, 17 May 2017 12:12:46 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="UtRB9637"; 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:from :to:cc:subject:date:message-id; q=dns; s=default; b=EZZ0HqWXsL9X jbmp2GKVAi0LRUhyHEAiERKZGGe1MZYR/0Xf+V2dOYNN7J6tWO6jJpOXFMxYGsyV NrkDljOBCzZCV6F2+SKk2NRP3Bk8KJkKSbnzXerpmr4mE6YhLTeCkJ3mVHkYHLhl UE80zwcdCYMRkwJll91ZcGuV9cQ/egg= 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:from :to:cc:subject:date:message-id; s=default; bh=KdQJT5VbFVzVIEfnOD uFhf84V2U=; b=UtRB9637aXEbWb3l5QSRPQ5/nEfRtOJ2fwEMxuJZbgTPiuxCDZ P4oY6sBcKQDzJsRNSkeRyRiT2YLrbq/tCe4rJcU6RPLDnuFlQVBji2NXzohEV/BW sjSReS+ttgRdYZwjvPAOGUVPbLbdnRVTxIFkmADkvpbdfVXtXaFUZWMg0= 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-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 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: Tue, 16 May 2017 19:12:16 -0700 Message-Id: <20170517021216.8236-1-andi@firstfloor.org> 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"); } }