Hi,
this patch fixes PR70269, an 5/6 regression.
When compiling with "-O2 -fipa-pta -fdump-ipa-pta-graph" we try to
initialize a graph dump file for ipa-cp, while the dump file is not
enabled, which causes an ICE because dump_file_name is NULL.
This condition in pass_init_dump_file enables the unnecessary
initialization, because dump_file is non-NULL:
...
if (initializing_dump
&& dump_file && (dump_flags & TDF_GRAPH)
&& cfun && (cfun->curr_properties & PROP_cfg))
...
The dump_file is non-NULL, but it's the dump file for ipa-pta, the pass
that calls cgraph_node:get_body which triggers the ipa transform of ipa-cp.
The patch fixes this by resetting dump_file to NULL in
cgraph_node::get_body.
OK for stage 4 trunk/5 branch if bootstrap and reg-test succeeds?
Thanks,
- Tom
Set dump_file to NULL in cgraph_node::get_body
2016-03-17 Tom de Vries <t...@codesourcery.com>
PR ipa/70269
* cgraph.c (cgraph_node::get_body): Set dump_file to NULL after save.
* gcc.dg/pr70269.c: New test.
---
gcc/cgraph.c | 1 +
gcc/testsuite/gcc.dg/pr70269.c | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 518ef24..4804081 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -3372,6 +3372,7 @@ cgraph_node::get_body (void)
const char *saved_dump_file_name = dump_file_name;
int saved_dump_flags = dump_flags;
dump_file_name = NULL;
+ dump_file = NULL;
push_cfun (DECL_STRUCT_FUNCTION (decl));
execute_all_ipa_transforms ();
diff --git a/gcc/testsuite/gcc.dg/pr70269.c b/gcc/testsuite/gcc.dg/pr70269.c
new file mode 100644
index 0000000..030cea1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr70269.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fipa-pta -fdump-ipa-pta-graph" } */
+
+void
+foo (void)
+{
+}