http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47775
--- Comment #3 from Fran Martinez Fadrique <fmartinez at gmv dot com> 2011-02-17 09:04:14 UTC --- The problem reported on the string_to_char is correct in the sense that if invoked with a non allocated string it would cause a segfault. When I run the case I get beore that the reported problem in the code ! Allocate memory for returned array ! if( allocated(res) ) then ! deallocate(res) ! end if ! allocate( res( size(list) ), stat=status ) allocate( res( size(list) ) ) if( status == 0 ) then ! Initialise navigation pointer lptr => list%first There is one invocation when the res array is already allocated when entering the routine. If I uncomment the commented lines and comment allocate( res( size(list) ) ) then I run to the very end because I protect the case when res is already allocated on entry to the function. I would have liked to isolate the problem in a simpler case but I really could not. If you let me know when the segfault happens (the call stack) in your case I can maybe simplify the high level unit test to remove any secondary effect from the trouble I report.