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

Wileam Yonatan Phan <wileamyp at outlook dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wileamyp at outlook dot com

--- Comment #1 from Wileam Yonatan Phan <wileamyp at outlook dot com> ---
Behavior confirmed with master@ff91735a5b8. The error message seems to change
if this code block is commented out in gcc/fortran/expr.cc

---

diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc
index be94c18c836..e5a3df214d7 100644
--- a/gcc/fortran/expr.cc
+++ b/gcc/fortran/expr.cc
@@ -3201,12 +3201,14 @@ gfc_match_init_expr (gfc_expr **result)
       return m;
     }

+  #if 0
   if (gfc_derived_parameter_expr (expr))
     {
       *result = expr;
       gfc_init_expr_flag = false;
       return m;
     }
+  #endif

   t = gfc_reduce_init_expr (expr);
   if (!t)

---

Anyway, the new error message is

pr102003.f90:6:33:

    6 |   integer, parameter :: m = len (p% c)  ! rejected
      |                                 1
Error: Parameter ā€˜p’ at (1) has not been declared or is a variable, which does
not reduce to a constant expression

Maybe something doesn't work properly in gfc_reduce_init_expr()?

Reply via email to