view gcc/testsuite/gfortran.dg/submodule_17.f08 @ 128:fe568345ddd5

fix CbC-example
author mir3636
date Wed, 11 Apr 2018 19:32:28 +0900
parents 04ced10e8804
children 84e7813d76e9
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) call abort
end