See: http://gcc.gnu.org/onlinedocs/gcc-3.4.4/g77/Loc-Intrinsic.html
Confirmed based on <http://gcc.gnu.org/ml/fortran/2005-07/msg00006.html>.
*** Bug 23064 has been marked as a duplicate of this bug. ***
*** Bug 23063 has been marked as a duplicate of this bug. ***
Subject: Bug 22282 CVSROOT: /cvs/gcc Module name: gcc Changes by: steven@gcc.gnu.org 2005-10-24 19:28:18 Modified files: gcc/fortran : ChangeLog check.c decl.c expr.c gfortran.h gfortran.texi intrinsic.c intrinsic.h intrinsic.texi invoke.texi iresolve.c lang.opt options.c resolve.c symbol.c trans-array.c trans-decl.c trans-expr.c trans-intrinsic.c trans.h gcc/testsuite : ChangeLog Added files: gcc/testsuite/gfortran.dg: cray_pointers_1.f90 cray_pointers_2.f90 cray_pointers_3.f90 loc_1.f90 loc_2.f90 Log message: 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. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&r1=1.597&r2=1.598 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/check.c.diff?cvsroot=gcc&r1=1.36&r2=1.37 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/decl.c.diff?cvsroot=gcc&r1=1.47&r2=1.48 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/expr.c.diff?cvsroot=gcc&r1=1.31&r2=1.32 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/gfortran.h.diff?cvsroot=gcc&r1=1.90&r2=1.91 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/gfortran.texi.diff?cvsroot=gcc&r1=1.24&r2=1.25 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/intrinsic.c.diff?cvsroot=gcc&r1=1.55&r2=1.56 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/intrinsic.h.diff?cvsroot=gcc&r1=1.33&r2=1.34 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/intrinsic.texi.diff?cvsroot=gcc&r1=1.17&r2=1.18 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/invoke.texi.diff?cvsroot=gcc&r1=1.22&r2=1.23 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/iresolve.c.diff?cvsroot=gcc&r1=1.43&r2=1.44 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/lang.opt.diff?cvsroot=gcc&r1=1.20&r2=1.21 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/options.c.diff?cvsroot=gcc&r1=1.27&r2=1.28 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/resolve.c.diff?cvsroot=gcc&r1=1.62&r2=1.63 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/symbol.c.diff?cvsroot=gcc&r1=1.38&r2=1.39 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-array.c.diff?cvsroot=gcc&r1=1.63&r2=1.64 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-decl.c.diff?cvsroot=gcc&r1=1.71&r2=1.72 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-expr.c.diff?cvsroot=gcc&r1=1.66&r2=1.67 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-intrinsic.c.diff?cvsroot=gcc&r1=1.55&r2=1.56 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans.h.diff?cvsroot=gcc&r1=1.37&r2=1.38 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6243&r2=1.6244 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/cray_pointers_1.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/cray_pointers_2.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/cray_pointers_3.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/loc_1.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/loc_2.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
.
Reopening since %loc was not added even though it should be easy to add now.
*** Bug 29575 has been marked as a duplicate of this bug. ***
FX, In spite of this morning's posting to the list, I will not be submitting a patch for %LOC but rather for %REF. I got stuck in vms space. Is there any functional difference between %LOC and %REF, do you know? Paul
%VAL, %REF and %DESCR have similar use and functionality, but %LOC is very different. It should in fact be an alias for function LOC, but it simply adding it in intrinsic.c with make_alias is not sufficient: creating a symbol name begining with a % has to be added to the parser and the symbol-name-mangler. My (short) attempt to do so failed, but it's probably not very difficult if you understand the binary tree structure of symbol names.
From what I see, this seems to be implemented in 4.2/4.3, not in 4.1.1. Is this still a P2? Will this be ever backported to 4.1.x?
This will not be backported to GCC 4.1. Thanks for catching this, it's very helpful to find bugs that won't be resolved in released compilers. There are already enough bugs in Bugzilla that do have to be fixed, so any help cleaning up the WONTFIX ones is great. Closing as FIXED because this is fixed for GCC 4.2 and GCC 4.3.