[Bug fortran/46100] [Fortran 2008] Non-variable pointer expression as actual argument to INTENT(OUT) non-pointer dummy

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Oct 20 18:02:00 GMT 2010


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46100

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-10-20 18:01:54 UTC ---
Untested patch:

diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 5711634..ef516a4 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -4316,7 +4316,18 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer,
const char* context)
   symbol_attribute attr;
   gfc_ref* ref;

-  if (e->expr_type != EXPR_VARIABLE)
+  if (!pointer && e->expr_type == EXPR_FUNCTION
+      && e->symtree->n.sym->result->attr.pointer)
+    {
+      if (!(gfc_option.allow_std & GFC_STD_F2008))
+       {
+         if (context)
+           gfc_error ("Fortran 2008: Pointer functions in variable definition"
+                      " context (%s) at %L", context, &e->where);
+         return FAILURE;
+       }
+    }
+  else if (e->expr_type != EXPR_VARIABLE)
     {
       if (context)
        gfc_error ("Non-variable expression in variable definition context
(%s)"



More information about the Gcc-bugs mailing list