From: Thomas Koenig Date: Mon, 24 Sep 2018 17:12:34 +0000 (+0000) Subject: re PR fortran/87397 (Clobbering intent(out) variables caused regression in OpenCoarra... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c109362313623d83fe0a5194bceaf994cf0c6ce0;p=gcc.git re PR fortran/87397 (Clobbering intent(out) variables caused regression in OpenCoarrays testsuite) 2018-09-24 Thomas Koenig PR fortran/87397 * gfc_conv_procedure_call: Do not add clobber on INTENT(OUT) for variables in an associate statement. 2018-09-24 Thomas Koenig PR fortran/87401 * gfortran.dg/intent_out_12.f90: New test. From-SVN: r264539 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 3901e2961a0..5bc88566ed0 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2018-09-24 Thomas Koenig + + PR fortran/87397 + * gfc_conv_procedure_call: Do not add clobber on INTENT(OUT) + for variables in an associate statement. + 2018-09-24 Bernhard Reuther-Fischer Cesar Philippidis diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index b3808dfa0a0..04210a4b6b1 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -5282,6 +5282,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, && !e->symtree->n.sym->attr.dummy /* FIXME - PR 87395 and PR 41453 */ && e->symtree->n.sym->attr.save == SAVE_NONE + && !e->symtree->n.sym->attr.associate_var && 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 b344f502c77..6e76e500c9d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-09-24 Thomas Koenig + + PR fortran/87401 + * gfortran.dg/intent_out_12.f90: New test. + 2018-09-24 Will Schmidt PR testsuite/86952 diff --git a/gcc/testsuite/gfortran.dg/intent_out_12.f90 b/gcc/testsuite/gfortran.dg/intent_out_12.f90 new file mode 100644 index 00000000000..e838bcbb4c2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/intent_out_12.f90 @@ -0,0 +1,23 @@ +! { dg-do run } +! PR fortran/87401 - this used to segfault at runtime. +! Test case by Janus Weil. + +program assoc_intent_out + + implicit none + + real :: r + + associate(o => r) + call sub(o) + end associate + +contains + + subroutine sub(out) + real, intent(out) :: out + out = 0.0 + end subroutine + +end +