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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gfortran.dg/] [auto_char_len_3.f90] - Diff between revs 149 and 154

Only display areas with differences | Details | Blame | View Log

Rev 149 Rev 154
! { dg-do run }
! { dg-do run }
! Test the fix for PR26257, in which the implicit reference to
! Test the fix for PR26257, in which the implicit reference to
! chararray in the main program call of chararray2string would
! chararray in the main program call of chararray2string would
! cause a segfault in gfc_build_addr_expr.
! cause a segfault in gfc_build_addr_expr.
!
!
! Based on the reduced testcase in the PR.
! Based on the reduced testcase in the PR.
module chtest
module chtest
contains
contains
  function chararray2string(chararray) result(text)
  function chararray2string(chararray) result(text)
    character(len=1), dimension(:) :: chararray    ! input
    character(len=1), dimension(:) :: chararray    ! input
    character(len=size(chararray, 1)) :: text      ! output
    character(len=size(chararray, 1)) :: text      ! output
    do i = 1,size(chararray,1)
    do i = 1,size(chararray,1)
      text(i:i) = chararray (i)
      text(i:i) = chararray (i)
    end do
    end do
  end function chararray2string
  end function chararray2string
end module chtest
end module chtest
program TestStringTools
program TestStringTools
  use chtest
  use chtest
  character(len=52)               :: txt
  character(len=52)               :: txt
  character(len=1), dimension(52) :: chararr = &
  character(len=1), dimension(52) :: chararr = &
        (/(char(i+64),char(i+96), i = 1,26)/)
        (/(char(i+64),char(i+96), i = 1,26)/)
  txt = chararray2string(chararr)
  txt = chararray2string(chararr)
  if (txt .ne. "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz") &
  if (txt .ne. "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz") &
        call abort ()
        call abort ()
end program TestStringTools
end program TestStringTools
! { dg-final { cleanup-modules "chtest" } }
! { 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.