OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gfortran.dg/] [auto_char_dummy_array_1.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 }
! This tests the fix for pr15809 in which automatic character length,
! This tests the fix for pr15809 in which automatic character length,
! dummy, pointer arrays were broken.
! dummy, pointer arrays were broken.
!
!
! contributed by Paul Thomas  
! contributed by Paul Thomas  
!
!
module global
module global
  character(12), dimension(2), target :: t
  character(12), dimension(2), target :: t
end module global
end module global
program oh_no_not_pr15908_again
program oh_no_not_pr15908_again
  character(12), dimension(:), pointer :: ptr
  character(12), dimension(:), pointer :: ptr
  call a (ptr, 12)
  call a (ptr, 12)
  if (.not.associated (ptr) ) call abort ()
  if (.not.associated (ptr) ) call abort ()
  if (any (ptr.ne."abc")) call abort ()
  if (any (ptr.ne."abc")) call abort ()
  ptr => null ()              ! ptr points to 't' here.
  ptr => null ()              ! ptr points to 't' here.
  allocate (ptr(3))
  allocate (ptr(3))
  ptr = "xyz"
  ptr = "xyz"
  call a (ptr, 12)
  call a (ptr, 12)
  if (.not.associated (ptr)) call abort ()
  if (.not.associated (ptr)) call abort ()
  if (any (ptr.ne."lmn")) call abort ()
  if (any (ptr.ne."lmn")) call abort ()
  call a (ptr, 0)
  call a (ptr, 0)
  if (associated (ptr)) call abort ()
  if (associated (ptr)) call abort ()
contains
contains
  subroutine a (p, l)
  subroutine a (p, l)
    use global
    use global
    character(l), dimension(:), pointer :: p
    character(l), dimension(:), pointer :: p
    character(l), dimension(3)          :: s
    character(l), dimension(3)          :: s
    s = "lmn"
    s = "lmn"
    if (l.ne.12) then
    if (l.ne.12) then
      deallocate (p)           ! ptr was allocated in main.
      deallocate (p)           ! ptr was allocated in main.
      p => null ()
      p => null ()
      return
      return
    end if
    end if
    if (.not.associated (p)) then
    if (.not.associated (p)) then
      t = "abc"
      t = "abc"
      p => t
      p => t
    else
    else
      if (size (p,1).ne.3) call abort ()
      if (size (p,1).ne.3) call abort ()
      if (any (p.ne."xyz")) call abort ()
      if (any (p.ne."xyz")) call abort ()
      p = s
      p = s
    end if
    end if
  end subroutine a
  end subroutine a
end program oh_no_not_pr15908_again
end program oh_no_not_pr15908_again
! { dg-final { cleanup-modules "global" } }
! { dg-final { cleanup-modules "global" } }
 
 

powered by: WebSVN 2.1.0

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