From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 58388 invoked by alias); 17 May 2017 07:55:04 -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 58356 invoked by uid 89); 17 May 2017 07:55:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-oi0-f67.google.com Received: from mail-oi0-f67.google.com (HELO mail-oi0-f67.google.com) (209.85.218.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 17 May 2017 07:55:00 +0000 Received: by mail-oi0-f67.google.com with SMTP id h4so818413oib.0 for ; Wed, 17 May 2017 00:55:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=MIFwokSNwPdI7JwAa3JsFS91WBHpWX7XKtyrU/fWKQk=; b=mrxzcBJsUuiJIh2j7LAcayUCKFSsaGabVcGnZHkFQGItR+kqnt6IuOBtHnqOSKRTNI AuAuE56svCrdmfgLAmQ2fxSjxNIE/MT3HdcELfk+u/pDYaHAaPwyb+A2ed4jqYamvLXh 4FwRRH0dFiM8tklV/3NFLo/5FRpJxhIurRYFyC4f/ZWrE01aKKcAd0vfpac6TmBFGduh ppf92lso/CVyM2zKunjdDFEj35ZfdRVtxLnk300SOZ4KlF5s6dCppQchldbBUnlyKjZk Rmshm1dwWEu1bCXN9BsFBsYlbBLUO4xdVHE1N6Rof/yMIuSAQHEPrp6XK0kUTVMiREOx jcjA== X-Gm-Message-State: AODbwcCOo7STBRrpHPARyJwGqf7cxO/FX5C3Qud/1EcDfbCbDDojI19t kN75qLaTWmxDD03AMbPmGDSYh/tnaw== X-Received: by 10.202.95.5 with SMTP id t5mr935700oib.19.1495007701981; Wed, 17 May 2017 00:55:01 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.51.83 with HTTP; Wed, 17 May 2017 00:55:01 -0700 (PDT) In-Reply-To: <20170517021216.8236-1-andi@firstfloor.org> References: <20170517021216.8236-1-andi@firstfloor.org> From: Richard Biener Date: Wed, 17 May 2017 08:45:00 -0000 Message-ID: Subject: Re: [PATCH] Dump functions for verification failures To: Andi Kleen Cc: GCC Patches , Andi Kleen Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2017-05/txt/msg01354.txt.bz2 On Wed, May 17, 2017 at 4:12 AM, Andi Kleen wrote: > 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. At this point the dump is probably redundant, there are also many other verify places. > * 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); So you still have to look what dump-file there is. > 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); Maybe we can instead hook into internal_error and a) report the pass (and dump_file) b) dump the actual error and a disclaimer c) dump the function ? That also catches all the places you forgot. > internal_error ("SSA corruption"); > } > } > -- > 2.12.2 >