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

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 ---
The following patch seems to solve this and to regtest ok:

diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 96a2cd70900..6ecd79beef0 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -2219,7 +2219,7 @@ gfc_simplify_expr (gfc_expr *p, int type)
          && gfc_intrinsic_func_interface (p, 1) == MATCH_ERROR)
        return false;

-      if (p->expr_type == EXPR_FUNCTION)
+      if (p->symtree && (p->value.function.isym || (p->ts.type ==
BT_UNKNOWN)))
        {
          if (p->symtree)
            isym = gfc_find_function (p->symtree->n.sym->name);

@Paul: can you comment on this as original author of that code block?

It appears that the original "if" was not intended as we are already in a

  switch (p->expr_type)
...
    case EXPR_FUNCTION:

Now my interpretation is: we want to do scalarize_intrinsic_call if we either
know already that the function did resolve to an intrinsic, or we have a name
but want to look it up.

(Omitting the latter part regression on gfortran.dg/fmt_nonchar_3.f90)

Reply via email to