diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-25 19:29:43 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-25 19:29:43 +0000 |
commit | 46dfcc3ee85a4a02abce4d45ee619f240c116af6 (patch) | |
tree | 6c3dc3d53cd17d62447673b81abbcfc69bacd2f3 /gcc/fortran/trans-decl.c | |
parent | 2a8624373adc103f943e22e781c2d6fadb828eae (diff) | |
download | gcc-46dfcc3ee85a4a02abce4d45ee619f240c116af6.tar.gz |
2011-08-25 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 178073 using svnmerge.
2011-08-25 Basile Starynkevitch <basile@starynkevitch.net>
* gcc/melt-runtime.c (melt_linemap_compute_current_location): Use the
linemap_position_for_column function for GCC 4.7 when merging with
GCC trunk rev 178073.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@178087 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/trans-decl.c')
-rw-r--r-- | gcc/fortran/trans-decl.c | 53 |
1 files changed, 41 insertions, 12 deletions
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 12c5262218d..1059a42f8ab 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -755,6 +755,7 @@ gfc_build_qualified_array (tree decl, gfc_symbol * sym) && !sym->attr.contained; if (sym->attr.codimension && gfc_option.coarray == GFC_FCOARRAY_LIB + && sym->as->type != AS_ASSUMED_SHAPE && GFC_TYPE_ARRAY_CAF_TOKEN (type) == NULL_TREE) { tree token; @@ -2104,12 +2105,11 @@ create_function_arglist (gfc_symbol * sym) f->sym->backend_decl = parm; - /* Coarrays which do not use a descriptor pass with -fcoarray=lib the - token and the offset as hidden arguments. */ + /* Coarrays which are descriptorless or assumed-shape pass with + -fcoarray=lib the token and the offset as hidden arguments. */ if (f->sym->attr.codimension && gfc_option.coarray == GFC_FCOARRAY_LIB - && !f->sym->attr.allocatable - && f->sym->as->type != AS_ASSUMED_SHAPE) + && !f->sym->attr.allocatable) { tree caf_type; tree token; @@ -2119,12 +2119,24 @@ create_function_arglist (gfc_symbol * sym) && !sym->attr.is_bind_c); caf_type = TREE_TYPE (f->sym->backend_decl); - gcc_assert (GFC_TYPE_ARRAY_CAF_TOKEN (caf_type) == NULL_TREE); token = build_decl (input_location, PARM_DECL, create_tmp_var_name ("caf_token"), build_qualified_type (pvoid_type_node, TYPE_QUAL_RESTRICT)); - GFC_TYPE_ARRAY_CAF_TOKEN (caf_type) = token; + if (f->sym->as->type == AS_ASSUMED_SHAPE) + { + gcc_assert (DECL_LANG_SPECIFIC (f->sym->backend_decl) == NULL + || GFC_DECL_TOKEN (f->sym->backend_decl) == NULL_TREE); + if (DECL_LANG_SPECIFIC (f->sym->backend_decl) == NULL) + gfc_allocate_lang_decl (f->sym->backend_decl); + GFC_DECL_TOKEN (f->sym->backend_decl) = token; + } + else + { + gcc_assert (GFC_TYPE_ARRAY_CAF_TOKEN (caf_type) == NULL_TREE); + GFC_TYPE_ARRAY_CAF_TOKEN (caf_type) = token; + } + DECL_CONTEXT (token) = fndecl; DECL_ARTIFICIAL (token) = 1; DECL_ARG_TYPE (token) = TREE_VALUE (typelist); @@ -2132,12 +2144,21 @@ create_function_arglist (gfc_symbol * sym) hidden_arglist = chainon (hidden_arglist, token); gfc_finish_decl (token); - gcc_assert (GFC_TYPE_ARRAY_CAF_OFFSET (caf_type) == NULL_TREE); offset = build_decl (input_location, PARM_DECL, create_tmp_var_name ("caf_offset"), gfc_array_index_type); - GFC_TYPE_ARRAY_CAF_OFFSET (caf_type) = offset; + if (f->sym->as->type == AS_ASSUMED_SHAPE) + { + gcc_assert (GFC_DECL_CAF_OFFSET (f->sym->backend_decl) + == NULL_TREE); + GFC_DECL_CAF_OFFSET (f->sym->backend_decl) = offset; + } + else + { + gcc_assert (GFC_TYPE_ARRAY_CAF_OFFSET (caf_type) == NULL_TREE); + GFC_TYPE_ARRAY_CAF_OFFSET (caf_type) = offset; + } DECL_CONTEXT (offset) = fndecl; DECL_ARTIFICIAL (offset) = 1; DECL_ARG_TYPE (offset) = TREE_VALUE (typelist); @@ -4453,6 +4474,9 @@ generate_local_decl (gfc_symbol * sym) || sym->attr.in_namelist)) gfc_warning ("Unused variable '%s' declared at %L", sym->name, &sym->declared_at); + else if (warn_unused_variable && sym->attr.use_only) + gfc_warning ("Unused module variable '%s' which has been explicitly " + "imported at %L", sym->name, &sym->declared_at); /* For variable length CHARACTER parameters, the PARM_DECL already references the length variable, so force gfc_get_symbol_decl @@ -4497,10 +4521,15 @@ generate_local_decl (gfc_symbol * sym) else if (sym->attr.flavor == FL_PARAMETER) { if (warn_unused_parameter - && !sym->attr.referenced - && !sym->attr.use_assoc) - gfc_warning ("Unused parameter '%s' declared at %L", sym->name, - &sym->declared_at); + && !sym->attr.referenced) + { + if (!sym->attr.use_assoc) + gfc_warning ("Unused parameter '%s' declared at %L", sym->name, + &sym->declared_at); + else if (sym->attr.use_only) + gfc_warning ("Unused parameter '%s' which has been explicitly " + "imported at %L", sym->name, &sym->declared_at); + } } else if (sym->attr.flavor == FL_PROCEDURE) { |