X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Ffortran%2Ftrans-decl.c;h=4b6e226582874c4f855ba235b8a8d573ec1b3f52;hb=b549d2a563c4d3ac93efc5f11577b023a6d6f270;hp=70e8e82856a93b7c18f6d7e3328108cf57a8dc10;hpb=9aad078e179c1a01621c7e907cb7d2674bbc2017;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 70e8e82856a..4b6e2265828 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -416,6 +416,11 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym) This is the equivalent of the TARGET variables. We also need to set this if the variable is passed by reference in a CALL statement. */ + + /* We don't want real declarations for Cray Pointees. */ + if (sym->attr.cray_pointee) + return; + if (sym->attr.target) TREE_ADDRESSABLE (decl) = 1; /* If it wasn't used we wouldn't be getting it. */ @@ -2251,6 +2256,10 @@ gfc_create_module_variable (gfc_symbol * sym) /* Create the decl. */ decl = gfc_get_symbol_decl (sym); + /* Don't create a "real" declaration for a Cray Pointee. */ + if (sym->attr.cray_pointee) + return; + /* Create the variable. */ pushdecl (decl); rest_of_decl_compilation (decl, 1, 0); @@ -2672,4 +2681,36 @@ gfc_generate_block_data (gfc_namespace * ns) rest_of_decl_compilation (decl, 1, 0); } +/* gfc_conv_cray_pointee takes a sym with attribute cray_pointee and + swaps in the backend_decl of its corresponding pointer. There are + 2 cases; one for variable size arrays, and one for everything else, + because variable-sized arrays require one fewer level of + indirection. */ + +tree +gfc_conv_cray_pointee(gfc_symbol *sym) +{ + tree decl = gfc_get_symbol_decl (sym->cp_pointer); + + /* Parameters need to be dereferenced. */ + if (sym->cp_pointer->attr.dummy) + decl = gfc_build_indirect_ref (decl); + + /* Check to see if we're dealing with a variable-sized array. */ + if (sym->attr.dimension + && TREE_CODE (TREE_TYPE (sym->backend_decl)) == POINTER_TYPE) + { + /* These decls will be derefenced later, so we don't dereference + them here. */ + decl = convert (TREE_TYPE (sym->backend_decl), decl); + } + else + { + decl = convert (build_pointer_type (TREE_TYPE (sym->backend_decl)), + decl); + decl = gfc_build_indirect_ref (decl); + } + return decl; +} + #include "gt-fortran-trans-decl.h"