From 92bba237da3fdaa4fb67186330355c95ff0072d5 Mon Sep 17 00:00:00 2001 From: Janus Weil Date: Mon, 5 Jun 2017 16:43:01 +0200 Subject: [PATCH] re PR fortran/70601 ([OOP] ICE on procedure pointer component call) 2017-06-05 Janus Weil PR fortran/70601 * trans-expr.c (gfc_conv_procedure_call): Fix detection of allocatable function results. 2017-06-05 Janus Weil PR fortran/70601 * gfortran.dg/proc_ptr_comp_50.f90: New test. From-SVN: r248878 --- gcc/fortran/ChangeLog | 6 +++++ gcc/fortran/trans-expr.c | 2 +- gcc/testsuite/ChangeLog | 5 ++++ .../gfortran.dg/proc_ptr_comp_50.f90 | 26 +++++++++++++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/proc_ptr_comp_50.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 7b61cc4fce5..33b2ac2ae23 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2017-06-05 Janus Weil + + PR fortran/70601 + * trans-expr.c (gfc_conv_procedure_call): Fix detection of allocatable + function results. + 2017-06-05 Nicolas Koenig PR fortran/35339 diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index af1549a611f..6af287e648c 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -6132,7 +6132,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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bed2af7c5c1..dd59e45a89a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-06-05 Janus Weil + + PR fortran/70601 + * gfortran.dg/proc_ptr_comp_50.f90: New test. + 2017-06-05 Nicolas Koenig PR fortran/35339 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 index 00000000000..d62d8326dd7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_comp_50.f90 @@ -0,0 +1,26 @@ +! { dg-do compile } +! +! PR 70601: [5/6/7 Regression] [OOP] ICE on procedure pointer component call +! +! Contributed by zmi + +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 -- 2.30.2