re PR fortran/87395 (ICE in in lookup_field_for_decl with whizard)
authorThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 23 Sep 2018 10:52:27 +0000 (10:52 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 23 Sep 2018 10:52:27 +0000 (10:52 +0000)
2018-09-23  Thomas Koenig  <tkoenig@gcc.gnu.org>

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  <tkoenig@gcc.gnu.org>

PR fortran/87395
* gfortran.dg/intent_out_10.f90: New test.

From-SVN: r264512

gcc/fortran/ChangeLog
gcc/fortran/trans-expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/intent_out_10.f90 [new file with mode: 0644]

index 6a7f7f26720ca69ae00405f397f955ab67674284..d8e8ed77223047e18a119bc15dacd6f439a70642 100644 (file)
@@ -1,3 +1,9 @@
+2018-09-23  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       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  <tkoenig@gcc.gnu.org>
 
        PR fortran/41453
index ae86d59272de16a4c8f26ed953aa10d26cbc031e..94f1d4d7a6855797ee0689f03565d52717ee4b9a 100644 (file)
@@ -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;
 
index d26e494c6dddd75df9e3e3bbf45a55e61f26fc0d..946c2b58af8d9505b9303ab88a5cc4f667fb9732 100644 (file)
@@ -1,3 +1,8 @@
+2018-09-23  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/87395
+       * gfortran.dg/intent_out_10.f90: New test.
+
 2018-09-22  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        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 (file)
index 0000000..82e928c
--- /dev/null
@@ -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