From: Thomas Koenig Date: Sun, 16 Dec 2018 14:32:46 +0000 (+0000) Subject: PF fortran/88364 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bd810d637041dba49a5aca3d085504575374ac6f;p=gcc.git PF fortran/88364 2018-12-16 Thomas Koenig PF fortran/88364 * trans-expr.c (gfc_conv_expr_reference): Do not add clobber if the expression contains a reference. 2018-12-16 Thomas Koenig PR fortran/88363 * intent_out_13.f90: New test. From-SVN: r267187 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 0034c3b714c..7220c9cb581 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2018-12-16 Thomas Koenig + + PF fortran/88364 + * trans-expr.c (gfc_conv_expr_reference): Do not add clobber if + the expression contains a reference. + 2018-12-15 Steven G. Kargl PR fortran/87944 @@ -9,7 +15,7 @@ PR fortran/88138 * decl.c (variable_decl): Check that a derived isn't being assigned an incompatible entity in an initialization. - + 2018-12-12 Jakub Jelinek PR fortran/88463 diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 64bda4c1e69..16a713551f0 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -8152,7 +8152,7 @@ gfc_conv_expr_reference (gfc_se * se, gfc_expr * expr, bool add_clobber) gfc_add_block_to_block (&se->pre, &se->post); se->expr = var; } - else if (add_clobber) + else if (add_clobber && expr->ref == NULL) { tree clobber; tree var; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d7ca87718ef..f47385bb761 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-12-16 Thomas Koenig + + PR fortran/88363 + * intent_out_13.f90: New test. + 2018-12-15 H.J. Lu PR target/88483 diff --git a/gcc/testsuite/gfortran.dg/intent_out_13.f90 b/gcc/testsuite/gfortran.dg/intent_out_13.f90 new file mode 100644 index 00000000000..ebbc5b7e769 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/intent_out_13.f90 @@ -0,0 +1,22 @@ +! { dg-do run } +! PR 88364 -- too much was clobbered on call. +module pr88364 + implicit none + type t + integer :: b = -1 + integer :: c = 2 + end type t +contains + subroutine f1 (x) + integer, intent(out) :: x + x = 5 + end subroutine f1 + subroutine f2 () + type(t) :: x + call f1 (x%b) + if (x%b .ne. 5 .or. x%c .ne. 2) stop 1 + end subroutine f2 +end module pr88364 + use pr88364 + call f2 +end