Array of Derived Data Types

I’m new to writing in the fortran 2003 standard and trying out some of the new object oriented facilities. I have run into a problem using an array of a parameterized derived data type…

I have a derived type defined as:

Type DataPoint(N)
     Integer,Len::N
     Real,Dimension(N)::x
     Real::f
     Real,Dimension(N)::df
     Real,Dimension(N,N)::d2f
   CONTAINS
     Procedure::FillData => FillDataPoint
     Procedure,Pass(InputDataPt)::Taylor => Taylor_MultiD
End Type DataPoint

In my main program I want to use an array of the DataPoint type and have defined my array as follows:

Integer,Parameter::NDim=3
Type(DataPoint(NDim)),Dimension(2)::InputData

I have a point where I try to initialize the values of InputData(1)%x and InputData(2)%x using

InputData(1)%x(1) = -1.0

That last line causes a seg fault at run time (the code compiles without any errors).

I assume I’m overlooking something simple, but I don’t know what. Any help would be greatly appreciated![/quote]

Hi HrantHratchian85478,

I sent this off to one of our compiler engineers who thinks this is a problem with the compiler. Hence, I added TPR#21747 and we will investigate.

Would you mind sending a reproducing example to PGI Customer Service (trs@pgroup.com)?

Thanks!
Mat

21747 - User code gets runtime error when using an array of a parameterized derived data type

The above TPR has been fixed in the 16.1 release, now available.

dave