https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51550
vehre at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |vehre at gcc dot gnu.org --- Comment #6 from vehre at gcc dot gnu.org --- I am working on fixing the remaining issue open to resolve this problem completely. During inspection of your code I figured, that the implementation of add_key_only () does not work. I had to change it this way: subroutine add_key_only( json_object, key ) type(json_data), target :: json_object character(len=*) :: key type(json_value), pointer :: value type(json_value), pointer :: last last => json_object%key_value if (associated (last)) then do while ( associated(last%next) ) write(*,*) 'Key found: ', last%key last => last%next enddo end if allocate( value ) allocate( character(len=len(key)) :: value%key ) value%key = key write(*,*) 'Inserting key: ', value%key, ', len: ', len(value%key) if (associated (last)) then last%next => value else json_object%key_value => value end if end subroutine add_key_only Which now works as expected.