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

--- Comment #2 from anlauf at gcc dot gnu.org ---
For reference: testcase, cross-checked with NAG 7.1:

! { dg-do run }
! PR fortran/110360

program p
  implicit none
  character,         allocatable :: ca
  character,         pointer     :: cp
  character(kind=4), allocatable :: ca4
  character(kind=4), pointer     :: cp4
  integer :: a = 65
  allocate (ca, cp, ca4, cp4)
  ca  =   "c"; cp  =   "d"
  ca4 = 4_"c"; cp4 = 4_"d"
  call val  ("A",char(65))
  call val  ("A",char(a))
  call val4 (4_"A",char(65,kind=4))
  call val4 (4_"A",char(a,kind=4))
  call val  (ca,ca)
  call val  (cp,cp)
  call val4 (ca4,ca4)
  call val4 (cp4,cp4)
  deallocate (ca, cp, ca4, cp4)
contains
  subroutine val (x, c)
    character(kind=1)        :: x
    character(kind=1), value :: c
    print *, "by value(kind=1): ", c
    if (x /= c) stop 1
  end
  subroutine val4 (x, c)
    character(kind=4)        :: x
    character(kind=4), value :: c
    print *, "by value(kind=4): ", c
    if (x /= c) stop 2
  end
end

Reply via email to