Split off from PR 41293. The following program should work, i.e. calling "sub" should initialize the component "gsl_file" with a NULL pointer.
module m use iso_c_binding type, public :: fgsl_file type(c_ptr) :: gsl_file = c_null_ptr end type fgsl_file contains subroutine sub(file) type(fgsl_file), intent(out) :: file end subroutine end module m use m type(fgsl_file) :: file call sub(file) if(c_associated(file%gsl_file)) call abort() end Using the 4.5 trunk (similar dump, same result with 4.3 and 4.4): sub (struct fgsl_file & restrict file) { if (file != 0) { { struct fgsl_file D.1336; struct fgsl_file fgsl_file.0; D.1336 = fgsl_file.0; *file = fgsl_file.0; } } } -- Summary: wrong-code: Default initializer ignored Product: gcc Version: 4.5.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: burnus at gcc dot gnu dot org OtherBugsDependingO 41293 nThis: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41298