aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/parse.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2011-05-07 07:38:08 +0200
committerTobias Burnus <burnus@gcc.gnu.org>2011-05-07 07:38:08 +0200
commit6f4d39bb3f20a2bdf5e8767596557030241f9219 (patch)
tree5f68d70948ef0ed456c9d5d7318754f161728822 /gcc/fortran/parse.c
parent9142588a737852f26d123802a1df171ef4ee0893 (diff)
downloadgcc-6f4d39bb3f20a2bdf5e8767596557030241f9219.zip
gcc-6f4d39bb3f20a2bdf5e8767596557030241f9219.tar.gz
gcc-6f4d39bb3f20a2bdf5e8767596557030241f9219.tar.bz2
re PR fortran/18918 (Eventually support Fortran 2008's coarrays [co-arrays])
2011-05-07 Tobias Burnus <burnus@net-b.de> PR fortran/18918 PR fortran/48919 * trans.h: Move gfc_init_coarray_decl prototype ... * gfortran.h: ... to here. * parse.c (translate_all_program_units): Call * gfc_init_coarray_decl. (gfc_parse_file): Update translate_all_program_units call. * trans-decl.c (gfc_init_coarray_decl): Fix variable * declaration, new argument whether DECL_EXTERNAL should be used. (create_main_function): Update gfc_init_coarray_decl call. * trans-intrinsic.c (trans_this_image, trans_image_index, conv_intrinsic_cobound): Ditto. From-SVN: r173528
Diffstat (limited to 'gcc/fortran/parse.c')
-rw-r--r--gcc/fortran/parse.c10
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: