https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92050
Bug ID: 92050
Summary: internal compiler error: in gfc_conv_procedure_call
Product: gcc
Version: 9.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: rp83 at gmx dot com
Target Milestone: ---
The module in the minimal working example below triggers an internal compiler
error when compiled with gfortran -fcheck=all.
- System: Ubuntu 18.04.3 LTS, 4.15.0-65-generic x86_64
- Command line that triggers the bug: gfortran -fcheck=all -c buggy.f95
- Regression: the bug is triggered when the code is compiled with gfortran
versions 9, 8, 7, but not with versions 5 and 6.
A few observations:
- Calling the function fun_par() directly rather than the binding "fun" does
not trigger the bug:
write(*,*) fun_par(this%m(1)%p, x)
- Defining "p" in "comp" using "type(par)" instead of "class(par)" does not
trigger the bug.
- Same bug when "p" is specified to be a pointer instead of an allocatable
vector.
- When the dimension of the result y in fun_par() is a scalar (y instead of
y(size(x))), the bug is not triggered.
MINIMAL WORKING EXAMPLE: buggy.f95
module buggy
implicit none
type :: par
contains
procedure, public :: fun => fun_par
end type par
type comp
class(par), allocatable :: p
end type comp
type foo
type(comp), allocatable :: m(:)
end type foo
contains
function fun_par(this)
class(par) :: this
integer:: fun_par(1)
fun_par = 0
end function fun_par
subroutine update_foo(this)
class(foo) :: this
write(*,*) this%m(1)%p%fun()
end subroutine update_foo
end module buggy
COMPILER OUTPUTS
The code was tested using gfortran versions 9, 8, 7, 6, and 5:
GNU Fortran (Ubuntu 9.2.1-8ubuntu1~18.04.york0) 9.2.1 20190909
GNU Fortran (Ubuntu 8.3.0-6ubuntu1~18.04.1) 8.3.0
GNU Fortran (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
GNU Fortran (Ubuntu 6.5.0-2ubuntu1~18.04) 6.5.0 20181026
GNU Fortran (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
using gfortran 5 and 6: no errors.
using gfortran 9, 8, and 7:
$ gfortran-9 -fcheck=all -c buggy.f95
buggy.f95:27:0:
27 | write(*,*) this%m(1)%p%fun()
|
internal compiler error: in gfc_conv_procedure_call, at
fortran/trans-expr.c:6785
Please submit a full bug report,
with preprocessed source if appropriate.
See for instructions.
$ gfortran-8 -fcheck=all -c buggy.f95
buggy.f95:27:0:
write(*,*) this%m(1)%p%fun()
internal compiler error: in gfc_conv_procedure_call, at
fortran/trans-expr.c:6410
Please submit a full bug report,
with preprocessed source if appropriate.
See for instructions.
$ gfortran-7 -fcheck=all -c buggy.f95
buggy.f95:27:0:
write(*,*) this%m(1)%p%fun()
internal compiler error: in gfc_conv_procedure_call, at
fortran/trans-expr.c:6290
Please submit a full bug report,
with preprocessed source if appropriate.
See for instructions.