1! { 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! 7program 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") STOP 1 21 a%array = array_t 22 if (any(a%array /= (/"abcd","efgh"/))) STOP 2 23 deallocate (a%scalar, a%array) 24 25! Now do pointer assignments. 26 a%scalar => scalar_t 27 if (a%scalar /= "abcd") STOP 3 28 a%array => array_t 29 if (any(a%array /= (/"abcd","efgh"/))) STOP 4 30 31end program char_pointer_comp_assign 32