This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/47240] [F03] segfault with procedure pointer component


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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |janus at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #4 from janus at gcc dot gnu.org 2011-01-10 21:50:21 UTC ---
The following patch fixes the wrong-code issue as well as the rejects-valid
problem from comment #2:

Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c    (revision 168617)
+++ gcc/fortran/trans-expr.c    (working copy)
@@ -3043,8 +3043,9 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol *
                && fsym->attr.flavor != FL_PROCEDURE)
               || (fsym->attr.proc_pointer
                   && !(e->expr_type == EXPR_VARIABLE
-                  && e->symtree->n.sym->attr.dummy))
-              || (e->expr_type == EXPR_VARIABLE
+                   && e->symtree->n.sym->attr.dummy))
+              || (fsym->attr.proc_pointer
+                  && e->expr_type == EXPR_VARIABLE
                   && gfc_is_proc_ptr_comp (e, NULL))
               || fsym->attr.allocatable))
             {
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c    (revision 168618)
+++ gcc/fortran/resolve.c    (working copy)
@@ -4858,6 +4858,9 @@ expression_rank (gfc_expr *e)

   for (ref = e->ref; ref; ref = ref->next)
     {
+      if (ref->type == REF_COMPONENT)
+    rank = ref->u.c.component->as ? ref->u.c.component->as->rank : 0;
+
       if (ref->type != REF_ARRAY)
     continue;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]