]> 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 19:23:48 +0000 (21:23 +0200)
committerJanus Weil <janus@gcc.gnu.org>
Fri, 9 Jun 2017 19:23:48 +0000 (21:23 +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: r249073

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 5d2f3b4aa6e46fbc839f800e34d9dbe4bbd1060d..1cb68f81b7f6cbe8506805dfb9e57c5be93ac11d 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-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
index 682fb0ec443430a26ed79e5336089014d8a1edc1..3e3955126b392861a698e860250ce3862bfdb139 100644 (file)
@@ -5855,7 +5855,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 1bdf9c9d8c97b3f7ae7ba0792d48c071f5daab1a..20f998d37e967ff1fbf6c228f7dad998829d0272 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