[Bug fortran/40005] segfault in gt_ggc_mx_lang_tree_node

jv244 at cam dot ac dot uk gcc-bugzilla@gcc.gnu.org
Fri Jul 24 12:28:00 GMT 2009

------- Comment #21 from jv244 at cam dot ac dot uk  2009-07-24 12:27 -------
(In reply to comment #20)
> As noticed in PR40011,
> All of gfortran.h seems to be ignorant of the GC - which means we may
> not garbage collect while the FE is still running, so all calls to
> cgraph_finalize_function should have true as their 2nd argument.

I tried this change, and now it segfaults later, I guess past the frontend.

#174670 0x0000000000530d51 in gt_ggc_mx_lang_tree_node (
    x_p=<value optimized out>) at ./gt-fortran-f95-lang.h:461
#174671 0x0000000000531127 in gt_ggc_mx_lang_tree_node (
    x_p=<value optimized out>) at ./gt-fortran-f95-lang.h:320
#174672 0x0000000000531259 in gt_ggc_mx_lang_tree_node (
    x_p=<value optimized out>) at ./gt-fortran-f95-lang.h:295
#174673 0x00000000006fb2d5 in gt_ggc_mx_cgraph_node (x_p=<value optimized out>)
    at gtype-desc.c:264
#174674 0x00000000006fb43e in gt_ggc_m_P11cgraph_node4htab (
    x_p=<value optimized out>) at gtype-desc.c:2207
#174675 0x00000000006c396f in ggc_mark_roots ()
---Type <return> to continue, or q <return> to quit---
    at /data03/vondele/gcc_trunk/gcc/gcc/ggc-common.c:137
#174676 0x000000000057e636 in ggc_collect ()
    at /data03/vondele/gcc_trunk/gcc/gcc/ggc-page.c:1944
#174677 0x0000000000756de5 in execute_todo (flags=19)
    at /data03/vondele/gcc_trunk/gcc/gcc/passes.c:1057
#174678 0x0000000000757083 in execute_one_pass (pass=0x11c9640)
    at /data03/vondele/gcc_trunk/gcc/gcc/passes.c:1309
#174679 0x0000000000757255 in execute_pass_list (pass=0x11c9640)
    at /data03/vondele/gcc_trunk/gcc/gcc/passes.c:1335
#174680 0x000000000084adb9 in tree_lowering_passes (fn=<value optimized out>)
    at /data03/vondele/gcc_trunk/gcc/gcc/tree-optimize.c:345
#174681 0x00000000009ae512 in cgraph_lower_function (node=0x7f2d97042600)
    at /data03/vondele/gcc_trunk/gcc/gcc/cgraphunit.c:501
#174682 0x00000000009aed7b in cgraph_analyze_function (node=0x7f2d97042600)
    at /data03/vondele/gcc_trunk/gcc/gcc/cgraphunit.c:814
#174683 0x00000000009b14e6 in cgraph_analyze_functions ()
    at /data03/vondele/gcc_trunk/gcc/gcc/cgraphunit.c:953
#174684 0x00000000009b1840 in cgraph_finalize_compilation_unit ()
    at /data03/vondele/gcc_trunk/gcc/gcc/cgraphunit.c:1039
#174685 0x000000000071c44d in write_global_declarations ()
    at /data03/vondele/gcc_trunk/gcc/gcc/langhooks.c:314
#174686 0x00000000007fa0db in toplev_main (argc=13, argv=0x7fff001a91b8)
    at /data03/vondele/gcc_trunk/gcc/gcc/toplev.c:1039
---Type <return> to continue, or q <return> to quit---
#174687 0x00007f2df6e0e436 in __libc_start_main () from /lib64/libc.so.6
#174688 0x000000000049b2f9 in _start ()

Just for reference:

Index: trans-decl.c
--- trans-decl.c        (revision 149846)
+++ trans-decl.c        (working copy)
@@ -2023,7 +2023,7 @@

       current_function_decl = NULL_TREE;

-      cgraph_finalize_function (thunk_fndecl, false);
+      cgraph_finalize_function (thunk_fndecl, true);

       /* We share the symbols in the formal argument list with other entry
         points and the master function.  Clear them so that they are
@@ -4104,7 +4104,7 @@
   /* Output the GENERIC tree.  */
   dump_function (TDI_original, ftn_main);

-  cgraph_finalize_function (ftn_main, false);
+  cgraph_finalize_function (ftn_main, true);

   if (old_context)
@@ -4375,7 +4375,7 @@
        added to our parent's nested function list.  */
     (void) cgraph_node (fndecl);
-    cgraph_finalize_function (fndecl, false);
+    cgraph_finalize_function (fndecl, true);

   gfc_trans_use_stmts (ns);
   gfc_traverse_ns (ns, gfc_emit_parameter_debug_info);



More information about the Gcc-bugs mailing list