[Bug fortran/50438] [F03] proc pointer to subroutine in structure constructors

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Apr 27 11:33:00 GMT 2013


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

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 #5 from janus at gcc dot gnu.org 2013-04-27 11:33:29 UTC ---
(In reply to comment #3)
> Here is a simple patch to avoid this:
>
> [...]
>
> It cures both test cases, but I'm pretty sure it will have quite a number of
> testsuite failures (haven't checked yet).

The patch from comment #3 indeed shows a huge number of failures (as expected).


> If we remove it here,
> 'gfc_reduce_init_expr' should be called somewhere at resolution stage, of
> course! We just need a suitable place for doing this ...

e.g. something like 'resolve_values' or 'resolve_structure_cons'?


However, I'm thinking that this approach may be too big of a hammer for the
problem at hand. A somewhat less invasive patch:

Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c    (revision 198155)
+++ gcc/fortran/expr.c    (working copy)
@@ -2522,6 +2522,8 @@ gfc_check_init_expr (gfc_expr *e)

       break;
     }
+      else if (e->symtree->n.sym->attr.flavor == FL_PROCEDURE)
+    break;

       if (gfc_in_match_data ())
     break;


This is also sufficient to remove the error. Regtesting now ...



More information about the Gcc-bugs mailing list