From 47e1596cc1e877485483de1eca7b3eb4bd049cfb Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sat, 8 Dec 2018 14:37:49 +0100 Subject: re PR fortran/88304 (ICE in use_pointer_in_frame, at tree-nested.c:267) PR fortran/88304 * tree-nested.c (convert_local_reference_stmt): Handle clobbers where lhs is not a decl normally, don't call use_pointer_in_frame on that lhs. * gfortran.fortran-torture/compile/pr88304-2.f90: New test. From-SVN: r266907 --- gcc/ChangeLog | 7 ++++++ gcc/testsuite/ChangeLog | 5 ++++ .../gfortran.fortran-torture/compile/pr88304-2.f90 | 28 ++++++++++++++++++++++ gcc/tree-nested.c | 3 ++- 4 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.fortran-torture/compile/pr88304-2.f90 (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3da7dbe..f97a51e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-12-08 Jakub Jelinek + + PR fortran/88304 + * tree-nested.c (convert_local_reference_stmt): Handle clobbers where + lhs is not a decl normally, don't call use_pointer_in_frame on that + lhs. + 2018-12-08 Eric Botcazou PR rtl-optimization/88390 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index afa3d70..dc7c204 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-12-08 Jakub Jelinek + + PR fortran/88304 + * gfortran.fortran-torture/compile/pr88304-2.f90: New test. + 2018-12-07 Paolo Carlini * g++.dg/other/bitfield7.C: New. diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/pr88304-2.f90 b/gcc/testsuite/gfortran.fortran-torture/compile/pr88304-2.f90 new file mode 100644 index 0000000..15bd451 --- /dev/null +++ b/gcc/testsuite/gfortran.fortran-torture/compile/pr88304-2.f90 @@ -0,0 +1,28 @@ +! PR fortran/88304 + +module pr88304 + implicit none + integer :: p +contains + function foo (x, y, z, w) + integer, intent(in) :: x, y + character(*), optional, intent(out) :: z + integer, optional, intent(out) :: w + integer :: foo + foo = 1 + end function foo + subroutine bar () + integer :: s + s = baz (1) + contains + function baz (u) + integer, intent(in) :: u + integer :: baz + integer :: q + integer :: r (10) + r = 0 + baz = 1 + q = foo (p, r(u), w = baz) + end function baz + end subroutine bar +end module pr88304 diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c index ea54246..0ad469a 100644 --- a/gcc/tree-nested.c +++ b/gcc/tree-nested.c @@ -2324,7 +2324,8 @@ convert_local_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p, if (gimple_clobber_p (stmt)) { tree lhs = gimple_assign_lhs (stmt); - if (!use_pointer_in_frame (lhs) + if (DECL_P (lhs) + && !use_pointer_in_frame (lhs) && lookup_field_for_decl (info, lhs, NO_INSERT)) { gsi_replace (gsi, gimple_build_nop (), true); -- cgit v1.1