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
7 program char_pointer_comp_assign
10 character (len=4), pointer :: scalar
11 character (len=4), pointer :: array(:)
14 character (len=4), target :: scalar_t ="abcd"
15 character (len=4), target :: array_t(2) = (/"abcd","efgh"/)
17 ! Do assignments first
18 allocate (a%scalar, a%array(2))
20 if (a%scalar /= "abcd") call abort ()
22 if (any(a%array /= (/"abcd","efgh"/))) call abort ()
23 deallocate (a%scalar, a%array)
25 ! Now do pointer assignments.
27 if (a%scalar /= "abcd") call abort ()
29 if (any(a%array /= (/"abcd","efgh"/))) call abort ()
31 end program char_pointer_comp_assign