[PATCH, fortran] PR71085 - ICE with some intrinsic functions specifying array function result dimension

Harald Anlauf anlauf@gmx.de
Fri Mar 2 20:52:00 GMT 2018


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  <anlauf@gmx.de>

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


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

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

-------------- next part --------------
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;
-------------- next part --------------
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.fuka@gmail.com>
+!
+program pr71085
+  print *, f()
+contains
+  function f()
+    integer :: f(iargc()*10)
+  end
+end


More information about the Fortran mailing list