https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128877

            Bug ID: 128877
           Summary: PDT Cannot convert INTEGER(4) to REAL(0) in component
                    initializer
           Product: gcc
           Version: 16.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pault at gcc dot gnu.org
  Target Milestone: ---

! { dg-do run }
!
! Contributed by Jerry Delisle  <[email protected]>
!
module pdt_kind_init_m
  implicit none
! real(k) :: x = 0 in a PDT with KIND parameter k was rejected:
! "Cannot convert INTEGER(4) to REAL(0)".  Valid (F2018 7.5.4.4)
! 16.2.1 rejects it too.
  type t(k)
    integer, kind :: k = kind(1.0)
    real(k) :: x = 0
  end type
end module


program p
  call pst_kind_param_real_init
contains
  subroutine pst_kind_param_real_init
    use pdt_kind_init_m
    implicit none
    type(t) :: a
    type(t(kind(1.0d0))) :: b
    if (a%x /= 0 .or. b%x /= 0) stop 1
  end subroutine pst_kind_param_real_init
end program

fails in compilation with

   12 |     real(k) :: x = 0
      |                  1
Error: Cannot convert INTEGER(4) to REAL(0) at (1)
../pdtbugsfoundwhiletestingsomeregressions/pdt_bug27.f90:21:9:

   21 |     use pdt_kind_init_m
      |         1
Fatal Error: Cannot open module file ‘pdt_kind_init_m.mod’ for reading at (1):
No such file or directory
compilation terminated.

Reply via email to