https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101762

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #3 from anlauf at gcc dot gnu.org ---
Untested patch:

diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 4971638f9b6..9d37a71abb9 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -2525,6 +2525,9 @@ match_pointer_init (gfc_expr **init, int procptr)
                       "initialization at %C"))
     return MATCH_ERROR;

+  if (!gfc_check_init_expr (*init))
+    return MATCH_ERROR;
+
   return MATCH_YES;
 }

This would result in:

pr101762.f90:3:28:

    3 |   integer, pointer :: x => a(n())
      |                            1
Error: Array 'a' at (1) is a variable, which does not reduce to a constant
expression

Reply via email to