diff options
author | Asher Langton <langton2@llnl.gov> | 2005-10-24 19:28:18 +0000 |
---|---|---|
committer | Steven Bosscher <steven@gcc.gnu.org> | 2005-10-24 19:28:18 +0000 |
commit | 83d890b9ba13c57aec4dcee1de9901ceab6e9a84 (patch) | |
tree | 3a890f87b8932e19f69eb45aa1082ec2a61e9711 /gcc/fortran/trans-array.c | |
parent | 086b011c2ec8b085e1668abd1f4e7e749ad45a2b (diff) | |
download | gcc-83d890b9ba13c57aec4dcee1de9901ceab6e9a84.zip gcc-83d890b9ba13c57aec4dcee1de9901ceab6e9a84.tar.gz gcc-83d890b9ba13c57aec4dcee1de9901ceab6e9a84.tar.bz2 |
Commit for Asher Langton
PR fortran/17031
PR fortran/22282
fortran/
* check.c (gfc_check_loc) : New function
* decl.c (variable_decl): New variables cp_as and sym. Added a
check for variables that have already been declared as Cray
Pointers, so we can get the necessary attributes without adding
a new symbol.
(attr_decl1): Added code to catch pointee symbols and "fix"
their array specs.
(cray_pointer_decl): New method.
(gfc_match_pointer): Added Cray pointer parsing code.
(gfc_mod_pointee_as): New method.
* expr.c (gfc_check_assign): added a check to catch vector-type
assignments to pointees with an unspecified final dimension.
* gfortran.h: (GFC_ISYM_LOC): New.
(symbol_attribute): Added cray_pointer and cray_pointee bits.
(gfc_array_spec): Added cray_pointee and cp_was_assumed bools.
(gfc_symbol): Added gfc_symbol *cp_pointer.
(gfc_option): Added flag_cray_pointer.
(gfc_add_cray_pointee): Declare.
(gfc_add_cray_pointer ): Declare.
(gfc_mod_pointee_as): Declare.
* intrinsic.c (add_functions): Add code for loc() intrinsic.
* intrinsic.h (gfc_check_loc): Declare.
(gfc_resolve_loc): Declare.
* iresolve.c (gfc_resolve_loc): New.
* lang.opt: Added fcray-pointer flag.
* options.c (gfc_init_options): Intialized
gfc_match_option.flag_cray_pointer.
(gfc_handle_option): Deal with -fcray-pointer.
* parse.c:(resolve_equivalence): Added code prohibiting Cray
pointees in equivalence statements.
* resolve.c (resolve_array_ref): Added code to prevent bounds
checking for Cray Pointee arrays.
(resolve_equivalence): Prohibited pointees in equivalence
statements.
* symbol.c (check_conflict): Added Cray pointer/pointee
attribute checking.
(gfc_add_cray_pointer): New
(gfc_add_cray_pointee): New
(gfc_copy_attr): New code for Cray pointers and pointees
* trans-array.c (gfc_trans_auto_array_allocation): Added code to
prevent space from being allocated for pointees.
(gfc_conv_array_parameter): Added code to catch pointees and
correctly set their base address.
* trans-decl.c (gfc_finish_var_decl): Added code to prevent
pointee declarations from making it to the back end.
(gfc_create_module_variable): Same.
* trans-expr.c (gfc_conv_variable): added code to detect and
translate pointees.
(gfc_conv_cray_pointee): New.
* trans-intrinsic.c (gfc_conv_intrinsic_loc): New.
(gfc_conv_intrinsic_function): added entry point for loc
translation.
* trans.h (gfc_conv_cray_pointee): Declare.
* gfortran.texi: Added section on Cray pointers, removed Cray
pointers from list of proposed extensions
* intrinsic.texi: Added documentation for loc intrinsic.
* invoke.texi: Documented -fcray-pointer flag
testsuite/
PR fortran/17031
PR fortran/22282
* gfortran.dg/cray_pointers_1.f90: New test.
* gfortran.dg/cray_pointers_2.f90: New test.
* gfortran.dg/cray_pointers_3.f90: New test.
* gfortran.dg/loc_1.f90: New test.
* gfortran.dg/loc_2.f90: New test.
From-SVN: r105859
Diffstat (limited to 'gcc/fortran/trans-array.c')
-rw-r--r-- | gcc/fortran/trans-array.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index c284dca..1a09121 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -3240,6 +3240,15 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, tree fnbody) size = gfc_trans_array_bounds (type, sym, &offset, &block); + /* Don't actually allocate space for Cray Pointees. */ + if (sym->attr.cray_pointee) + { + if (TREE_CODE (GFC_TYPE_ARRAY_OFFSET (type)) == VAR_DECL) + gfc_add_modify_expr (&block, GFC_TYPE_ARRAY_OFFSET (type), offset); + gfc_add_expr_to_block (&block, fnbody); + return gfc_finish_block (&block); + } + /* The size is the number of elements in the array, so multiply by the size of an element to get the total size. */ tmp = TYPE_SIZE_UNIT (gfc_get_element_type (type)); @@ -4074,7 +4083,13 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, int g77) && expr->ref->u.ar.type == AR_FULL && g77) { sym = expr->symtree->n.sym; - tmp = gfc_get_symbol_decl (sym); + + /* Check to see if we're dealing with a Cray Pointee. */ + if (sym->attr.cray_pointee) + tmp = gfc_conv_cray_pointee (sym); + else + tmp = gfc_get_symbol_decl (sym); + if (sym->ts.type == BT_CHARACTER) se->string_length = sym->ts.cl->backend_decl; if (!sym->attr.pointer && sym->as->type != AS_ASSUMED_SHAPE @@ -4625,4 +4640,3 @@ gfc_walk_expr (gfc_expr * expr) res = gfc_walk_subexpr (gfc_ss_terminator, expr); return gfc_reverse_ss (res); } - |