From: Jakub Jelinek Date: Thu, 6 Dec 2018 10:28:31 +0000 (+0100) Subject: re PR fortran/88304 (ICE in use_pointer_in_frame, at tree-nested.c:267) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a126d36172d336ee92f18b5c0fcf60a16690c2f0;p=gcc.git re PR fortran/88304 (ICE in use_pointer_in_frame, at tree-nested.c:267) PR fortran/88304 * tree-nested.c (convert_nonlocal_reference_stmt): Remove clobbers for non-local automatic decls. * gfortran.fortran-torture/compile/pr88304.f90: New test. From-SVN: r266847 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 216f6eec668..b60efcf4821 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-12-06 Jakub Jelinek + + PR fortran/88304 + * tree-nested.c (convert_nonlocal_reference_stmt): Remove clobbers + for non-local automatic decls. + 2018-12-05 David Edelsohn * config/rs6000/aix72.h (ASM_DEFAULT_SPEC): Match Power7 processor diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 76c44a6ffba..bc5bf6720ec 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-12-06 Jakub Jelinek + + PR fortran/88304 + * gfortran.fortran-torture/compile/pr88304.f90: New test. + 2018-12-06 Richard Biener PR middle-end/63184 diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/pr88304.f90 b/gcc/testsuite/gfortran.fortran-torture/compile/pr88304.f90 new file mode 100644 index 00000000000..fb69b8c9918 --- /dev/null +++ b/gcc/testsuite/gfortran.fortran-torture/compile/pr88304.f90 @@ -0,0 +1,24 @@ +! PR fortran/88304 + +module pr88304 + implicit none + type t + integer :: b = -1 + end type t +contains + subroutine f1 (x, y) + integer, intent(out) :: x, y + x = 5 + y = 6 + end subroutine f1 + subroutine f2 () + type(t) :: x + integer :: y + call f3 + if (x%b .ne. 5 .or. y .ne. 6) stop 1 + contains + subroutine f3 + call f1 (x%b, y) + end subroutine f3 + end subroutine f2 +end module pr88304 diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c index 3ab60a78015..ea542466574 100644 --- a/gcc/tree-nested.c +++ b/gcc/tree-nested.c @@ -1648,6 +1648,21 @@ convert_nonlocal_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p, *handled_ops_p = false; return NULL_TREE; + case GIMPLE_ASSIGN: + if (gimple_clobber_p (stmt)) + { + tree lhs = gimple_assign_lhs (stmt); + if (DECL_P (lhs) + && !(TREE_STATIC (lhs) || DECL_EXTERNAL (lhs)) + && decl_function_context (lhs) != info->context) + { + gsi_replace (gsi, gimple_build_nop (), true); + break; + } + } + *handled_ops_p = false; + return NULL_TREE; + default: /* For every other statement that we are not interested in handling here, let the walker traverse the operands. */