OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gfortran.dg/] [auto_char_len_3.f90] - Blame information for rev 302

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 302 jeremybenn
! { dg-do run }
2
! Test the fix for PR26257, in which the implicit reference to
3
! chararray in the main program call of chararray2string would
4
! cause a segfault in gfc_build_addr_expr.
5
!
6
! Based on the reduced testcase in the PR.
7
module chtest
8
contains
9
  function chararray2string(chararray) result(text)
10
    character(len=1), dimension(:) :: chararray    ! input
11
    character(len=size(chararray, 1)) :: text      ! output
12
    do i = 1,size(chararray,1)
13
      text(i:i) = chararray (i)
14
    end do
15
  end function chararray2string
16
end module chtest
17
program TestStringTools
18
  use chtest
19
  character(len=52)               :: txt
20
  character(len=1), dimension(52) :: chararr = &
21
        (/(char(i+64),char(i+96), i = 1,26)/)
22
  txt = chararray2string(chararr)
23
  if (txt .ne. "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz") &
24
        call abort ()
25
end program TestStringTools
26
 
27
! { dg-final { cleanup-modules "chtest" } }

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.