]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR fortran/70601 ([OOP] ICE on procedure pointer component call)
authorJanus Weil <janus@gcc.gnu.org>
Fri, 9 Jun 2017 18:10:48 +0000 (20:10 +0200)
committerJanus Weil <janus@gcc.gnu.org>
Fri, 9 Jun 2017 18:10:48 +0000 (20:10 +0200)
2017-06-09  Janus Weil  <janus@gcc.gnu.org>

Backport from trunk
PR fortran/70601
* trans-expr.c (gfc_conv_procedure_call): Fix detection of allocatable
function results.

2017-06-09  Janus Weil  <janus@gcc.gnu.org>

Backport from trunk
PR fortran/70601
* gfortran.dg/proc_ptr_comp_50.f90: New test.

From-SVN: r249067

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

index a66d2bec7d8ac5e611a377391aa60db55127731b..5fb3b2f154cdbaba6b36c2d4437662d20c5cd560 100644 (file)
@@ -1,3 +1,10 @@
+2017-06-09  Janus Weil  <janus@gcc.gnu.org>
+
+       Backport from trunk
+       PR fortran/70601
+       * trans-expr.c (gfc_conv_procedure_call): Fix detection of allocatable
+       function results.
+
 2017-05-03  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/65542
index 26cd43921513271c906468813181e32ea4c7542d..31146c290de5c388f69a76990c3c6de8dfd451d8 100644 (file)
@@ -6072,7 +6072,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
      after use. This necessitates the creation of a temporary to
      hold the result to prevent duplicate calls.  */
   if (!byref && sym->ts.type != BT_CHARACTER
-      && sym->attr.allocatable && !sym->attr.dimension)
+      && sym->attr.allocatable && !sym->attr.dimension && !comp)
     {
       tmp = gfc_create_var (TREE_TYPE (se->expr), NULL);
       gfc_add_modify (&se->pre, tmp, se->expr);
index 368fee3a5d7d2efbc04e21f13f41c8f7e8012319..0ea0587a70240a5b1f10aef2bdee0310e9eb70a2 100644 (file)
@@ -1,3 +1,9 @@
+2017-06-09  Janus Weil  <janus@gcc.gnu.org>
+
+       Backport from trunk
+       PR fortran/70601
+       * gfortran.dg/proc_ptr_comp_50.f90: New test.
+
 2017-06-08  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/81006
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_50.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_50.f90
new file mode 100644 (file)
index 0000000..d62d832
--- /dev/null
@@ -0,0 +1,26 @@
+! { dg-do compile }
+!
+! PR 70601: [5/6/7 Regression] [OOP] ICE on procedure pointer component call
+!
+! Contributed by zmi <zmi007@gmail.com>
+
+program test
+  implicit none
+
+  type :: concrete_type
+    procedure (run_concrete_type), pointer :: run
+  end type
+
+  type(concrete_type), allocatable :: concrete
+
+  allocate(concrete)
+  concrete % run => run_concrete_type
+  call concrete % run()
+
+contains
+
+   subroutine run_concrete_type(this)
+      class(concrete_type) :: this
+   end subroutine
+
+end