1! { dg-do run } 2program foo 3 4 implicit none 5 6 character(len=4) :: s 7 character(len=10) :: a 8 9 ! This works. 10 s = 'abc' 11 associate(t => s) 12 if (trim(t) /= 'abc') STOP 1 13 end associate 14 15 ! This failed. 16 associate(u => 'abc') 17 if (trim(u) /= 'abc') STOP 2 18 end associate 19 20 ! This failed. 21 a = s // 'abc' 22 associate(v => s // 'abc') 23 if (trim(v) /= trim(a)) STOP 3 24 end associate 25 26 ! This failed. 27 a = trim(s) // 'abc' 28 associate(w => trim(s) // 'abc') 29 if (trim(w) /= trim(a)) STOP 4 30 end associate 31 32 ! This failed. 33 associate(x => trim('abc')) 34 if (trim(x) /= 'abc') STOP 5 35 end associate 36 37end program foo 38