diff mbox series

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

Message ID 5A99B981.5090807@gmx.de
State New
Headers show
Series [fortran] PR71085 - ICE with some intrinsic functions specifying array function result dimension | expand

Commit Message

Harald Anlauf March 2, 2018, 8:52 p.m. UTC
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.

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

Comments

Steve Kargl March 4, 2018, 5:14 a.m. UTC | #1
On Fri, Mar 02, 2018 at 09:52:17PM +0100, Harald Anlauf wrote:
> 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.
> 

Commit on 6-branch, 7-branch, and trunk.
diff mbox series

Patch

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;