On 08/22/2012 03:03 PM, Jakub Jelinek wrote:
init_function_start is these days supposed to be called only at the start of
RTL expansion, it shouldn't be called much earlier, because then we leak
e.g. the memory allocated by init_emit.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

OK. That way it makes much more sense how init_function_start works. Thanks for the patch!

Tobias

2012-08-22  Jakub Jelinek  <ja...@redhat.com>

        * trans-decl.c (trans_function_start, generate_coarray_init,
        create_main_function, gfc_generate_constructors): Call
        allocate_struct_function instead of init_function_start.

--- gcc/fortran/trans-decl.c.jj 2012-08-13 14:36:51.000000000 +0200
+++ gcc/fortran/trans-decl.c    2012-08-22 12:18:29.963953958 +0200
@@ -2265,7 +2265,8 @@ trans_function_start (gfc_symbol * sym)
    /* Create RTL for function definition.  */
    make_decl_rtl (fndecl);
- init_function_start (fndecl);
+  gcc_checking_assert (DECL_STRUCT_FUNCTION (fndecl) == NULL);
+  allocate_struct_function (fndecl, false);
/* function.c requires a push at the start of the function. */
    pushlevel ();
@@ -4408,7 +4409,8 @@ generate_coarray_init (gfc_namespace * n
rest_of_decl_compilation (fndecl, 0, 0);
    make_decl_rtl (fndecl);
-  init_function_start (fndecl);
+  gcc_checking_assert (DECL_STRUCT_FUNCTION (fndecl) == NULL);
+  allocate_struct_function (fndecl, false);
pushlevel ();
    gfc_init_block (&caf_init_block);
@@ -4982,7 +4984,8 @@ create_main_function (tree fndecl)
rest_of_decl_compilation (ftn_main, 1, 0);
    make_decl_rtl (ftn_main);
-  init_function_start (ftn_main);
+  gcc_checking_assert (DECL_STRUCT_FUNCTION (ftn_main) == NULL);
+  allocate_struct_function (ftn_main, false);
    pushlevel ();
gfc_init_block (&body);
@@ -5537,7 +5540,8 @@ gfc_generate_constructors (void)
make_decl_rtl (fndecl); - init_function_start (fndecl);
+  gcc_checking_assert (DECL_STRUCT_FUNCTION (fndecl) == NULL);
+  allocate_struct_function (fndecl, false);
pushlevel ();

Reply via email to