aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorAsher Langton <langton2@llnl.gov>2006-05-30 23:27:38 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2006-05-30 23:27:38 +0000
commit7074ea72d10e861505f70e2e12060c3909474bf7 (patch)
treee61a9fb26be5623e3ec18415f7dc47ffb285e9c2 /gcc/fortran
parent9cb96754ae0a6af89ec8286d6a68d76c70698a65 (diff)
downloadgcc-7074ea72d10e861505f70e2e12060c3909474bf7.zip
gcc-7074ea72d10e861505f70e2e12060c3909474bf7.tar.gz
gcc-7074ea72d10e861505f70e2e12060c3909474bf7.tar.bz2
symbol.c (check_conflict): Allow external, function, and subroutine attributes with Cray pointees.
2006-05-30 Asher Langton <langton2@llnl.gov> * symbol.c (check_conflict): Allow external, function, and subroutine attributes with Cray pointees. * trans-expr.c (gfc_conv_function_val): Translate Cray pointees that point to procedures. * gfortran.texi: Document new feature. * gfortran.dg/cray_pointers_7.f90: New test. From-SVN: r114252
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog8
-rw-r--r--gcc/fortran/gfortran.texi17
-rw-r--r--gcc/fortran/symbol.c3
-rw-r--r--gcc/fortran/trans-expr.c3
4 files changed, 27 insertions, 4 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 701f236..59da690 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,11 @@
+2006-05-30 Asher Langton <langton2@llnl.gov>
+
+ * symbol.c (check_conflict): Allow external, function, and
+ subroutine attributes with Cray pointees.
+ * trans-expr.c (gfc_conv_function_val): Translate Cray pointees
+ that point to procedures.
+ * gfortran.texi: Document new feature.
+
2006-05-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/27634
diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi
index bfafbfc..260e76f 100644
--- a/gcc/fortran/gfortran.texi
+++ b/gcc/fortran/gfortran.texi
@@ -1107,13 +1107,28 @@ pointers will ``incorrectly'' optimize code with illegal aliasing.)
There are a number of restrictions on the attributes that can be
applied to Cray pointers and pointees. Pointees may not have the
-attributes ALLOCATABLE, INTENT, OPTIONAL, DUMMY, TARGET, EXTERNAL,
+attributes ALLOCATABLE, INTENT, OPTIONAL, DUMMY, TARGET,
INTRINSIC, or POINTER. Pointers may not have the attributes
DIMENSION, POINTER, TARGET, ALLOCATABLE, EXTERNAL, or INTRINSIC.
Pointees may not occur in more than one pointer statement. A pointee
cannot be a pointer. Pointees cannot occur in equivalence, common, or
data statements.
+A Cray pointer may point to a function or a subroutine. For example,
+the following excerpt is valid:
+@smallexample
+ implicit none
+ external sub
+ pointer (subptr,subpte)
+ external subpte
+ subptr = loc(sub)
+ call subpte()
+ [...]
+ subroutine sub
+ [...]
+ end subroutine sub
+@end smallexample
+
A pointer may be modified during the course of a program, and this
will change the location to which the pointee refers. However, when
pointees are passed as arguments, they are treated as ordinary
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index bd7ad1c..7acef42 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -385,11 +385,8 @@ check_conflict (symbol_attribute * attr, const char * name, locus * where)
conf (cray_pointee, optional);
conf (cray_pointee, dummy);
conf (cray_pointee, target);
- conf (cray_pointee, external);
conf (cray_pointee, intrinsic);
conf (cray_pointee, pointer);
- conf (cray_pointee, function);
- conf (cray_pointee, subroutine);
conf (cray_pointee, entry);
conf (cray_pointee, in_common);
conf (cray_pointee, in_equivalence);
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index b91ebf6..752609c 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -1191,6 +1191,9 @@ gfc_conv_function_val (gfc_se * se, gfc_symbol * sym)
sym->backend_decl = gfc_get_extern_function_decl (sym);
tmp = sym->backend_decl;
+ if (sym->attr.cray_pointee)
+ tmp = convert (build_pointer_type (TREE_TYPE (tmp)),
+ gfc_get_symbol_decl (sym->cp_pointer));
if (!POINTER_TYPE_P (TREE_TYPE (tmp)))
{
gcc_assert (TREE_CODE (tmp) == FUNCTION_DECL);