[Bug fortran/50438] [F03] proc pointer to subroutine in structure constructors
janus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Sep 17 18:36:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50438
--- Comment #3 from janus at gcc dot gnu.org 2011-09-17 17:44:25 UTC ---
I think the problem is that the structure constructor is resolved too early
(already when parsing the corresponding source line, where 'aproc' is not known
yet).
Here is a simple patch to avoid this:
Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c (revision 178927)
+++ gcc/fortran/expr.c (working copy)
@@ -2654,7 +2654,6 @@ gfc_match_init_expr (gfc_expr **result)
{
gfc_expr *expr;
match m;
- gfc_try t;
expr = NULL;
@@ -2667,14 +2666,6 @@ gfc_match_init_expr (gfc_expr **result)
return m;
}
- t = gfc_reduce_init_expr (expr);
- if (t != SUCCESS)
- {
- gfc_free_expr (expr);
- gfc_init_expr_flag = false;
- return MATCH_ERROR;
- }
-
*result = expr;
gfc_init_expr_flag = false;
It cures both test cases, but I'm pretty sure it will have quite a number of
testsuite failures (haven't checked yet). 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 ...
More information about the Gcc-bugs
mailing list