view gcc/testsuite/gfortran.dg/function_charlen_2.f90 @ 144:8f4e72ab4e11

fix segmentation fault caused by nothing next cur_op to end
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 21:23:56 +0900
parents 84e7813d76e9
children
line wrap: on
line source

! { dg-do compile }
! Tests the fix for PR34429 in which function charlens that were
! USE associated would cause an error.
!
! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
!
module m
  integer, parameter :: l = 2
  character(2) :: cl
end module m

program test
  implicit none
  integer, parameter :: l = 5
  character(len = 10) :: c
  character(4) :: cl
  c = f ()
  if (g () /= "2") STOP 1
contains
  character(len = l) function f ()
    use m
    if (len (f) /= 2) STOP 2
    f = "a"
  end function f
  character(len = len (cl)) function g ()
    use m
    g = "4"
    if (len (g) == 2) g= "2"
  end function g
end program test