view gcc/testsuite/gfortran.dg/pdt_10.f03 @ 118:fd00160c1b76

ifdef TARGET_64BIT
author mir3636
date Tue, 27 Feb 2018 15:01:35 +0900
parents 04ced10e8804
children 84e7813d76e9
line wrap: on
line source

! { dg-do run }
!
! Fixes problem setting CHARACTER KIND expressions in PDT components
! and resolution of intrinsic functions and numeric expressions.
!
! Contributed by FortranFan on clf thread "Parameterized Derived Types
! make first appearance in gfortran 8.0.0"
!
program p
   use, intrinsic :: iso_fortran_env, only : CK => character_kinds
   implicit none
   character(kind = 4), parameter :: c = 'a'
   type :: pdt_t(k,l)
      integer, kind :: k = CK(1)
      integer, len :: l
      character(kind=k,len=l) :: s
   end type
   type(pdt_t(l=12)) :: foo
   type(pdt_t(k = kind (c), l=12)) :: foo_4

   foo%s = "Hello World!"
   if (foo%s .ne. "Hello World!") call abort
   if (KIND (foo%s) .ne. 1) call abort
   if (len (foo%s) .ne. 12) call abort

   foo_4%s = "Hello World!"
   if (foo_4%s .ne. "Hello World!") call abort
   if (KIND (foo_4%s) .ne. 1) call abort
   if (len (foo_4%s) .ne. 12) call abort
end program