diff --git gcc/cgraphunit.c gcc/cgraphunit.c
index 8280fc4..0860c86 100644
--- gcc/cgraphunit.c
+++ gcc/cgraphunit.c
@@ -501,6 +501,20 @@ cgraph_node::add_new_function (tree fndecl, bool lowered)
 {
   gcc::pass_manager *passes = g->get_passes ();
   cgraph_node *node;
+
+  if (dump_file)
+    {
+      const char *function_type = ((gimple_has_body_p (fndecl))
+				   ? (lowered
+				      ? "low gimple"
+				      : "high gimple")
+				   : "to-be-gimplified");
+      fprintf (dump_file,
+	       "Added new %s function %s to callgraph\n",
+	       function_type,
+	       fndecl_name (fndecl));
+    }
+
   switch (symtab->state)
     {
       case PARSING:
@@ -629,7 +643,6 @@ cgraph_node::analyze (void)
 	 body.  */
       if (!gimple_has_body_p (decl))
 	gimplify_function_tree (decl);
-      dump_function (TDI_generic, decl);
 
       /* Lower the function.  */
       if (!lowered)
diff --git gcc/gimplify.c gcc/gimplify.c
index 9214648..d6c500d 100644
--- gcc/gimplify.c
+++ gcc/gimplify.c
@@ -87,6 +87,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "gimple-low.h"
 #include "cilk.h"
 #include "gomp-constants.h"
+#include "tree-dump.h"
 
 #include "langhooks-def.h"	/* FIXME: for lhd_set_decl_assembler_name */
 #include "tree-pass.h"		/* FIXME: only for PROP_gimple_any */
@@ -9435,6 +9436,8 @@ gimplify_function_tree (tree fndecl)
   cfun->curr_properties = PROP_gimple_any;
 
   pop_cfun ();
+
+  dump_function (TDI_generic, fndecl);
 }
 
 /* Return a dummy expression of type TYPE in order to keep going after an
diff --git gcc/omp-low.c gcc/omp-low.c
index fac32b3..2839d8f 100644
--- gcc/omp-low.c
+++ gcc/omp-low.c
@@ -109,6 +109,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "lto-section-names.h"
 #include "gomp-constants.h"
 #include "gimple-pretty-print.h"
+#include "tree-dump.h"
 
 
 /* Lowering of OMP parallel and workshare constructs proceeds in two
@@ -1714,6 +1715,7 @@ finalize_task_copyfn (gomp_task *task_stmt)
   pop_cfun ();
 
   /* Inform the callgraph about the new function.  */
+  dump_function (TDI_generic, child_fn);
   cgraph_node::add_new_function (child_fn, false);
 }
 
@@ -6073,6 +6075,8 @@ expand_omp_taskreg (struct omp_region *region)
       /* Inform the callgraph about the new function.  */
       DECL_STRUCT_FUNCTION (child_fn)->curr_properties = cfun->curr_properties;
       cgraph_node::add_new_function (child_fn, true);
+      if (dump_file)
+	dump_function_to_file (child_fn, dump_file, dump_flags);
 
       /* Fix the callgraph edges for child_cfun.  Those for cfun will be
 	 fixed in a following pass.  */
@@ -9527,6 +9531,8 @@ expand_omp_target (struct omp_region *region)
       /* Inform the callgraph about the new function.  */
       DECL_STRUCT_FUNCTION (child_fn)->curr_properties = cfun->curr_properties;
       cgraph_node::add_new_function (child_fn, true);
+      if (dump_file)
+	dump_function_to_file (child_fn, dump_file, dump_flags);
 
 #ifdef ENABLE_OFFLOADING
       /* Add the new function to the offload table.  */
diff --git gcc/stor-layout.c gcc/stor-layout.c
index 273a12b..b3f9852 100644
--- gcc/stor-layout.c
+++ gcc/stor-layout.c
@@ -318,7 +318,6 @@ finalize_size_functions (void)
       set_cfun (NULL);
       dump_function (TDI_original, fndecl);
       gimplify_function_tree (fndecl);
-      dump_function (TDI_generic, fndecl);
       cgraph_node::finalize_function (fndecl, false);
     }
 
diff --git gcc/testsuite/gcc.dg/gomp/dump-task.c gcc/testsuite/gcc.dg/gomp/dump-task.c
new file mode 100644
index 0000000..08ae5c3
--- /dev/null
+++ gcc/testsuite/gcc.dg/gomp/dump-task.c
@@ -0,0 +1,33 @@
+/* https://gcc.gnu.org/ml/gcc/2014-03/msg00312.html
+   https://gcc.gnu.org/ml/gcc/2014-05/msg00117.html */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-gimple -fdump-tree-ompexp" } */
+
+int
+main(void)
+{
+#pragma omp parallel
+  {
+    extern void foo(void);
+    foo ();
+  }
+  return 0;
+}
+
+
+/* Check that low gimple representation does not end up in high gimple
+   dump.  */
+/* { dg-final { scan-tree-dump-not "main._omp_fn.0" "gimple" } } */
+
+/* Check for 3 references in ompexp dump: new function notification, function
+   dump and reference in main.  */
+/* { dg-final { scan-tree-dump-times "main._omp_fn.0" 3 "ompexp" } } */
+
+/* Check for function dump of main._omp_fn.0.  */
+/* { dg-final { scan-tree-dump-times "main._omp_fn.0 \\(void" 1 "ompexp" } } */
+
+/* Check for presence of function body of main._omp_fn.0.  */
+/* { dg-final { scan-tree-dump-times "foo \\(\\)" 1 "ompexp" } } */
+
+/* { dg-final { cleanup-tree-dump "gimple" } } */
+/* { dg-final { cleanup-tree-dump "ompexp" } } */
