This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Committed] Fix -fdump-tree-profile-details dump without a loop
- From: Andrew Pinski <pinskia at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 23 Nov 2006 09:57:11 -0800
- Subject: [Committed] Fix -fdump-tree-profile-details dump without a loop
Hi,
The problem here is before Zdenek's patch, we did not use
current_loops but instead a local variable which is always non null.
But after Zdenek's patch, we could get a null current_loops and when
calling flow_loops_dump, we would crash. This fixes the problem by
adding a null check before calling flow_loops_dump.
This was suggested by Daniel Berlin.
Committed as obvious after a bootstrap/test.
Thanks,
Andrew Pinski
ChangeLog:
* predict.c (tree_estimate_probability): Check to make
sure current_loops is non null before calling flow_loops_dump.
* gcc.dg/tree-ssa/dump-1.c: New test.
Index: predict.c
===================================================================
--- predict.c (revision 119114)
+++ predict.c (working copy)
@@ -1251,7 +1251,7 @@ tree_estimate_probability (void)
basic_block bb;
loop_optimizer_init (0);
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (current_loops && dump_file && (dump_flags & TDF_DETAILS))
flow_loops_dump (current_loops, dump_file, NULL, 0);
add_noreturn_fake_exit_edges ();
Index: testsuite/gcc.dg/tree-ssa/dump-1.c
===================================================================
--- testsuite/gcc.dg/tree-ssa/dump-1.c (revision 0)
+++ testsuite/gcc.dg/tree-ssa/dump-1.c (revision 0)
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-profile-details" } */
+
+int f(void)
+{
+ return 0;
+}
+
+/* { dg-final { cleanup-tree-dump "profile" } } */