diff options
Diffstat (limited to 'gcc/fortran/f95-lang.c')
-rw-r--r-- | gcc/fortran/f95-lang.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c index 5b67621..9d0bf44 100644 --- a/gcc/fortran/f95-lang.c +++ b/gcc/fortran/f95-lang.c @@ -88,6 +88,7 @@ static void gfc_init_builtin_functions (void); /* Each front end provides its own. */ static bool gfc_init (void); static void gfc_finish (void); +static void gfc_write_global_declarations (void); static void gfc_print_identifier (FILE *, tree, int); void do_function_end (void); int global_bindings_p (void); @@ -99,6 +100,7 @@ static void gfc_init_ts (void); #undef LANG_HOOKS_NAME #undef LANG_HOOKS_INIT #undef LANG_HOOKS_FINISH +#undef LANG_HOOKS_WRITE_GLOBALS #undef LANG_HOOKS_INIT_OPTIONS #undef LANG_HOOKS_HANDLE_OPTION #undef LANG_HOOKS_POST_OPTIONS @@ -127,6 +129,7 @@ static void gfc_init_ts (void); #define LANG_HOOKS_NAME "GNU Fortran" #define LANG_HOOKS_INIT gfc_init #define LANG_HOOKS_FINISH gfc_finish +#define LANG_HOOKS_WRITE_GLOBALS gfc_write_global_declarations #define LANG_HOOKS_INIT_OPTIONS gfc_init_options #define LANG_HOOKS_HANDLE_OPTION gfc_handle_option #define LANG_HOOKS_POST_OPTIONS gfc_post_options @@ -282,6 +285,33 @@ gfc_finish (void) return; } +/* ??? This is something of a hack. + + Emulated tls lowering needs to see all TLS variables before we call + cgraph_finalize_compilation_unit. The C/C++ front ends manage this + by calling decl_rest_of_compilation on each global and static variable + as they are seen. The Fortran front end waits until this hook. + + A Correct solution is for cgraph_finalize_compilation_unit not to be + called during the WRITE_GLOBALS langhook, and have that hook only do what + its name suggests and write out globals. But the C++ and Java front ends + have (unspecified) problems with aliases that gets in the way. It has + been suggested that these problems would be solved by completing the + conversion to cgraph-based aliases. */ + +static void +gfc_write_global_declarations (void) +{ + tree decl; + + /* Finalize all of the globals. */ + for (decl = getdecls(); decl ; decl = DECL_CHAIN (decl)) + rest_of_decl_compilation (decl, true, true); + + write_global_declarations (); +} + + static void gfc_print_identifier (FILE * file ATTRIBUTE_UNUSED, tree node ATTRIBUTE_UNUSED, |