The fix to the PR probably counts as obvious, but here it is, along
with a testcase.  Changelogs below.

Regtested on i686-pc-linux-gnu.

Whoever reviews this, please feel free to commit.

Thanks,
Harald


2018-03-02  Harald Anlauf  <anl...@gmx.de>

        PR fortran/71085
        * trans-expr.c (gfc_apply_interface_mapping_to_expr): Do not
        dereference NULL pointer.


2018-03-02  Harald Anlauf  <anl...@gmx.de>

        PR fortran/71085
        * gfortran.dg/pr71085.f90: New test.

Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c    (revision 258112)
+++ gcc/fortran/trans-expr.c    (working copy)
@@ -4349,6 +4349,8 @@
 
       if (expr->value.function.esym == NULL
            && expr->value.function.isym != NULL
+           && expr->value.function.actual
+           && expr->value.function.actual->expr
            && expr->value.function.actual->expr->symtree
            && gfc_map_intrinsic_function (expr, mapping))
        break;
Index: gcc/testsuite/gfortran.dg/pr71085.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr71085.f90       (revision 0)
+++ gcc/testsuite/gfortran.dg/pr71085.f90       (revision 0)
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! PR 71085
+!
+! Testcase from PR by Vladimir Fuka <vladimir.f...@gmail.com>
+!
+program pr71085
+  print *, f()
+contains
+  function f()
+    integer :: f(iargc()*10)
+  end
+end

Reply via email to