view gcc/testsuite/gfortran.dg/submodule_17.f08 @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 84e7813d76e9
children
line wrap: on
line source

! { dg-do run }
!
! Tests the fix for PR77358, in which the wrong gfc_charlen was
! being used for the result of 'get'.
!
! Contributed by Damian Rouson  <damian@sourceryinstitute.org>
!
module hello_interface
  character(len=13) :: string="Hello, world!"
  interface
    module function get() result(result_string)
      character(:), allocatable :: result_string
    end function
  end interface
end module

submodule(hello_interface) hello_implementation
contains
  module function get() result(result_string)
    character(:), allocatable :: result_string
    result_string = string
  end function
end submodule

  use hello_interface
  if (get() .ne. string) STOP 1
end