diff options
Diffstat (limited to 'gcc/fortran/parse.c')
-rw-r--r-- | gcc/fortran/parse.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c index ff029bf..80fcf00 100644 --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -4231,13 +4231,19 @@ clean_up_modules (gfc_gsymbol *gsym) is active. This could be in a different order to resolution if there are forward references in the file. */ static void -translate_all_program_units (gfc_namespace *gfc_global_ns_list) +translate_all_program_units (gfc_namespace *gfc_global_ns_list, + bool main_in_tu) { int errors; gfc_current_ns = gfc_global_ns_list; gfc_get_errors (NULL, &errors); + /* If the main program is in the translation unit and we have + -fcoarray=libs, generate the static variables. */ + if (gfc_option.coarray == GFC_FCOARRAY_LIB && main_in_tu) + gfc_init_coarray_decl (true); + /* We first translate all modules to make sure that later parts of the program can use the decl. Then we translate the nonmodules. */ @@ -4475,7 +4481,7 @@ prog_units: } /* Do the translation. */ - translate_all_program_units (gfc_global_ns_list); + translate_all_program_units (gfc_global_ns_list, seen_program); termination: |