From ee7fb0588c6361b4d77337ab0f7527be64fcdde2 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Sun, 23 Sep 2018 10:52:27 +0000 Subject: [PATCH] re PR fortran/87395 (ICE in in lookup_field_for_decl with whizard) 2018-09-23 Thomas Koenig PR fortran/87395 * gfc_conv_procedure_call: Reformat comments slightly. Do not add clobber on INTENT(OUT) for saved variables. 2018-09-23 Thomas Koenig PR fortran/87395 * gfortran.dg/intent_out_10.f90: New test. From-SVN: r264512 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/trans-expr.c | 5 ++++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/intent_out_10.f90 | 14 ++++++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/intent_out_10.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 6a7f7f26720..d8e8ed77223 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2018-09-23 Thomas Koenig + + PR fortran/87395 + * gfc_conv_procedure_call: Reformat comments slightly. Do not add + clobber on INTENT(OUT) for saved variables. + 2018-09-22 Thomas Koenig PR fortran/41453 diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index ae86d59272d..94f1d4d7a68 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -5281,7 +5281,10 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, add_clobber = fsym && fsym->attr.intent == INTENT_OUT && !fsym->attr.allocatable && !fsym->attr.pointer && !e->symtree->n.sym->attr.pointer - && !e->symtree->n.sym->attr.dummy /* See PR 41453. */ + /* See PR 41453. */ + && !e->symtree->n.sym->attr.dummy + /* FIXME - PR 87395 and PR 41453 */ + && e->symtree->n.sym->attr.save == SAVE_NONE && e->ts.type != BT_CHARACTER && e->ts.type != BT_DERIVED && e->ts.type != BT_CLASS && !sym->attr.elemental; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d26e494c6dd..946c2b58af8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-09-23 Thomas Koenig + + PR fortran/87395 + * gfortran.dg/intent_out_10.f90: New test. + 2018-09-22 Thomas Koenig PR fortran/41453 diff --git a/gcc/testsuite/gfortran.dg/intent_out_10.f90 b/gcc/testsuite/gfortran.dg/intent_out_10.f90 new file mode 100644 index 00000000000..82e928c98fa --- /dev/null +++ b/gcc/testsuite/gfortran.dg/intent_out_10.f90 @@ -0,0 +1,14 @@ +! { dg-do compile } +! PR 87395 - this used to ICE +module mo + integer, save :: x +contains + subroutine foo + x = 42 + call bar(x) + contains + subroutine bar(y) + integer, intent(out) :: y + end subroutine bar + end subroutine foo +end module mo -- 2.30.2