https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92065
Bug ID: 92065 Summary: internal compiler error: in expand_expr_real_1 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 following minimal working example triggers an internal compiler error when compiled with gfortran -c buggy.f95. Compiler error appears with gfortran versions 9, 8, 7, 6, but not version 5. See outputs below. Tests run on Ubuntu 18.04.3 LTS, 4.15.0-65-generic x86_64. ================================================= buggy.f95: module buggy implicit none type :: bar integer :: x end type bar type :: foo integer :: n contains procedure :: fun1 procedure :: fun2 end type foo contains subroutine fun1(this, a) implicit none class(foo) :: this class(bar), intent(in) :: a(this%n) end subroutine fun1 integer function fun2(this, a) implicit none class(foo) :: this class(bar), intent(in) :: a(this%n) fun2 = a(1)%x end function fun2 end module buggy ================================================= COMPILER OUTPUTS with GNU Fortran (Ubuntu 9.2.1-8ubuntu1~18.04.york0) 9.2.1 20190909: $ gfortran-9 -c buggy.f95 during RTL pass: expand buggy.f95:23:0: 23 | integer function fun2(this, a) | internal compiler error: in expand_expr_real_1, at expr.c:10012 Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-9/README.Bugs> for instructions. with GNU Fortran (Ubuntu 8.3.0-6ubuntu1~18.04.1) 8.3.0: $ gfortran-8 -c buggy.f95 during RTL pass: expand buggy.f95:23:0: integer function fun2(this, a) internal compiler error: in expand_expr_real_1, at expr.c:10047 Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-8/README.Bugs> for instructions. with GNU Fortran (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0: $ gfortran-7 -c buggy.f95 buggy.f95:23:0: integer function fun2(this, a) internal compiler error: in expand_expr_real_1, at expr.c:9912 Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions. with GNU Fortran (Ubuntu 6.5.0-2ubuntu1~18.04) 6.5.0 20181026: $ gfortran-6 -c buggy.f95 buggy.f95:23:0: integer function fun2(this, a) internal compiler error: in expand_expr_real_1, at expr.c:9702 Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions. with GNU Fortran (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010: no compiler error.