From 213ab0a6c49f10069615b98d38bb794f844cf433 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Fri, 2 Jan 2015 14:34:58 +0100 Subject: trans-decl.c (gfc_build_qualified_array): Fix coarray tokens for module coarrays with -fcoarray=lib. 2015-01-02 Tobias Burnus * trans-decl.c (gfc_build_qualified_array): Fix coarray tokens for module coarrays with -fcoarray=lib. 2015-01-02 Tobias Burnus * gfortran.dg/coarray/codimension_2.f90: New. * gfortran.dg/coarray/codimension_2a.f90: New. * gfortran.dg/coarray_35.f90: New. * gfortran.dg/coarray_35a.f90: New. From-SVN: r219142 --- gcc/fortran/ChangeLog | 7 ++++++- gcc/fortran/trans-decl.c | 18 +++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) (limited to 'gcc/fortran') diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index e45269e..ea72687 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2015-01-02 Tobias Burnus + + * trans-decl.c (gfc_build_qualified_array): Fix coarray tokens + for module coarrays with -fcoarray=lib. + 2015-01-02 Janus Weil PR fortran/60507 @@ -5,7 +10,7 @@ expression is a procedure-pointer result. (compare_actual_formal): Use it. -Copyright (C) 2014 Free Software Foundation, Inc. +Copyright (C) 2015 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 75b84f1..9ef6bfc 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -819,10 +819,22 @@ gfc_build_qualified_array (tree decl, gfc_symbol * sym) && GFC_TYPE_ARRAY_CAF_TOKEN (type) == NULL_TREE) { tree token; + tree token_type = build_qualified_type (pvoid_type_node, + TYPE_QUAL_RESTRICT); + + if (sym->module && (sym->attr.use_assoc + || sym->ns->proc_name->attr.flavor == FL_MODULE)) + { + tree token_name + = get_identifier (gfc_get_string (GFC_PREFIX ("caf_token%s"), + IDENTIFIER_POINTER (gfc_sym_mangled_identifier (sym)))); + token = build_decl (DECL_SOURCE_LOCATION (decl), VAR_DECL, token_name, + token_type); + TREE_PUBLIC (token) = 1; + } + else + token = gfc_create_var_np (token_type, "caf_token"); - token = gfc_create_var_np (build_qualified_type (pvoid_type_node, - TYPE_QUAL_RESTRICT), - "caf_token"); GFC_TYPE_ARRAY_CAF_TOKEN (type) = token; DECL_ARTIFICIAL (token) = 1; TREE_STATIC (token) = 1; -- cgit v1.1