aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-cfg.c
diff options
context:
space:
mode:
authorAlexandre Oliva <oliva@adacore.com>2021-07-24 23:05:32 -0300
committerAlexandre Oliva <oliva@gnu.org>2021-08-17 08:00:40 -0300
commit3ed8da759b52708f6874af2afc6ab56b1fb00cec (patch)
tree17171dc4c83202bf9eb92a463039e2aae9e26d6f /gcc/tree-cfg.c
parentd1819df86fbe42125cccb2fc2959a0bf51e524d6 (diff)
downloadgcc-3ed8da759b52708f6874af2afc6ab56b1fb00cec.zip
gcc-3ed8da759b52708f6874af2afc6ab56b1fb00cec.tar.gz
gcc-3ed8da759b52708f6874af2afc6ab56b1fb00cec.tar.bz2
don't access cfun in dump_function_to_file
dump_function_to_file takes the function to dump as a parameter, and parts of it use the local fun variable where cfun would be used elsewhere. Others use cfun, presumably in error. Fixed to use fun uniformly. Added a few more tests for non-NULL fun before dereferencing it. for gcc/ChangeLog * tree-cfg.c (dump_function_to_file): Use fun, not cfun.
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r--gcc/tree-cfg.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 9883eaa..61b5391 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -8075,9 +8075,9 @@ dump_function_to_file (tree fndecl, FILE *file, dump_flags_t flags)
: (fun->curr_properties & PROP_cfg) ? "cfg"
: "");
- if (cfun->cfg)
+ if (fun && fun->cfg)
{
- basic_block bb = ENTRY_BLOCK_PTR_FOR_FN (cfun);
+ basic_block bb = ENTRY_BLOCK_PTR_FOR_FN (fun);
if (bb->count.initialized_p ())
fprintf (file, ",%s(%" PRIu64 ")",
profile_quality_as_string (bb->count.quality ()),
@@ -8163,8 +8163,8 @@ dump_function_to_file (tree fndecl, FILE *file, dump_flags_t flags)
tree name;
- if (gimple_in_ssa_p (cfun))
- FOR_EACH_SSA_NAME (ix, name, cfun)
+ if (gimple_in_ssa_p (fun))
+ FOR_EACH_SSA_NAME (ix, name, fun)
{
if (!SSA_NAME_VAR (name)
/* SSA name with decls without a name still get
@@ -8200,7 +8200,7 @@ dump_function_to_file (tree fndecl, FILE *file, dump_flags_t flags)
fprintf (file, "}\n");
}
- else if (fun->curr_properties & PROP_gimple_any)
+ else if (fun && (fun->curr_properties & PROP_gimple_any))
{
/* The function is now in GIMPLE form but the CFG has not been
built yet. Emit the single sequence of GIMPLE statements