Dear All, The attached patch represents progress to date. It fixes the original problem in this PR and allows John Reid's version of iso_varying_string/vocabulary_word_count.f90 to compile and run correctly. It even bootstraps and regtests! However, it doe not fix: PR51976 comment #6 and PR51550 - allocate with typespec ICEs PR51976 comment #6 FORALL assignment is messed up and ICEs.. PR47545 the compiler complains about the lack of an initializer for the hidden character length field. PR45170 will need going through from one end to the other - there is a lot of "stuff" here! Of these, I consider the fix of the PR47545 problem to be a must and the allocate with typespec desirable. Cheers Paul 2013-02-24 Paul Thomas PR fortran/51976 * gfortran.h : Add deferred_parameter attribute. * primary.c (build_actual_constructor): It is not an error if a missing component has the deferred_parameter attribute; equally, if one is given a value, it is an error. * resolve.c (resolve_fl_derived0): Remove error for deferred character length components. Add the hidden string length field to the structure. Give it the deferred_parameter attribute. * trans-array.c (duplicate_allocatable): Add a strlen field which is used as the element size if it is non-null. (gfc_duplicate_allocatable, gfc_copy_allocatable_data): Pass a NULL to the new argument in duplicate_allocatable. (structure_alloc_comps): Set the hidden string length as appropriate. Use it in calls to duplicate_allocatable. (gfc_alloc_allocatable_for_assignment): When a deferred length backend declaration is variable, use that; otherwise use the string length from the expression evaluation. * trans-expr.c (gfc_conv_component_ref): If this is a deferred character length component, the string length should have the value of the hidden string length field. (gfc_trans_subcomponent_assign): Set the hidden string length field for deferred character length components. Allocate the necessary memory for the string. (alloc_scalar_allocatable_for_assignment): Same change as in gfc_alloc_allocatable_for_assignment above. * trans-stmt.c (gfc_trans_allocate): Likewise. * trans-types.c (gfc_get_derived_type): Set the tree type for a deferred character length component. * trans.c (gfc_deferred_strlen): New function. * trans.h : Prototype for the new function. 2013-02-24 Paul Thomas PR fortran/51976 * gfortran.dg/deferred_type_component_1.f90 : New test.