Silverfrost Forums

Welcome to our forums

Regression in 7.2 with type initialisation in optional out

24 Aug 2015 2:27 #16757

FTN95 version 7.20 crashes when calling a subroutine/function with an optional, output parameter that is a type with initialiser.

In the following example:

module TestOptionalParam

  type OptionalType
    integer:: intVal  = 42     ! crash with initialisation, works if omitted
  end type OptionalType

contains

  subroutine FuncWithOptParam(optParam)
    type(OptionalType), optional, intent(out):: optParam
  end subroutine FuncWithOptParam

end module TestOptionalParam

program TestOptionalParamFunc
  use TestOptionalParam

  type(OptionalType):: param

  call FuncWithOptParam(param)   ! no not crash if param present
  call FuncWithOptParam()        ! crashes with param missing
end program TestOptionalParamFunc

The crash occurs on the second entry to the subroutine. It is caused by the combination of: . initialisation within the type - if the initialisation is removed the call succeeds . intent(out) - if this is removed or changed to intent(in out) all is well . if the optional parameter is included in the call it's okay

This worked fine in 7.10.

Alan

24 Aug 2015 2:41 #16758

Thanks for the feedback. I have logged this for investigation.

31 May 2016 5:48 #17527

This has now been fixed for the next release.

1 Jun 2016 10:10 #17530

That's great news - any idea when this will be, I'm keep to use v8 but this bug has been preventing me.

1 Jun 2016 11:57 #17533

It will be the version after 8.0 but I don't know when that will be released. Probably a relatively short time given that 8.0 is a major version.

Please login to reply.