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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [char_pointer_comp_assign.f90] - Blame information for rev 694

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 694 jeremybenn
! { dg-do run }
2
! This test the fix of PR18283, where assignments of scalar,
3
! character pointer components of derived types caused an ICE.
4
! It also checks that the array counterparts remain operational.
5
! Contributed by Paul Thomas  pault@gcc.gnu.org
6
!
7
program char_pointer_comp_assign
8
  implicit none
9
  type :: dt
10
     character (len=4), pointer :: scalar
11
     character (len=4), pointer :: array(:)
12
  end type dt
13
  type (dt) :: a
14
  character (len=4), target :: scalar_t ="abcd"
15
  character (len=4), target :: array_t(2) = (/"abcd","efgh"/)
16
 
17
! Do assignments first
18
  allocate (a%scalar, a%array(2))
19
  a%scalar = scalar_t
20
  if (a%scalar /= "abcd") call abort ()
21
  a%array = array_t
22
  if (any(a%array /= (/"abcd","efgh"/))) call abort ()
23
  deallocate (a%scalar, a%array)
24
 
25
! Now do pointer assignments.
26
  a%scalar => scalar_t
27
  if (a%scalar /= "abcd") call abort ()
28
  a%array => array_t
29
  if (any(a%array /= (/"abcd","efgh"/))) call abort ()
30
 
31
end program char_pointer_comp_assign

powered by: WebSVN 2.1.0

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