Silverfrost Forums

Welcome to our forums

More allocation/pointer problems in 5.20.1

10 Apr 2008 5:12 #3026

I have an dynamic array of integers implemented within an ADT as a pointer:

type ADT integer:: ntiles integer, pointer:: tilerefs(:) ⇒ NULL() end type ADT

I have a fixed array of these things:

type(ADT):: adtarray(10)

And I allocate and fill the tilerefs array within a loop using:

adtarray(i)%ntiles = 6 ! array size varies allocate(adtarray(i)%tilerefs(adtarray(i)%ntiles))

This is where everything goes potty. For the first iteration it sometimes seems okay, then later on at some point some other data in my ADT is corrupted. In addition, if I break at the point just AFTER the allocation and watch adtarray, the tileref entry is shown as:

tilerefs Unassigned(INTEGER*4(6))

While array size is the correct value, the Unassigned is not good. If I compile with 5.10 or earlier then everything works as it should and the debugger shows:

tilerefs INTEGER*4(6)

I haven't tried this out on a small program (need to get on with other stuff), but I guess this may be another incarnation of the problems others are seeing.

All tests done on XP with v 5.20.1 on VS2005 and VS2008

Please login to reply.