Silverfrost Forums

Welcome to our forums

New storage model?

24 Jun 2010 2:39 #6553

New storage model?

Today I’ve got an error and I’m looking for help. I use a module in which I declare a raster image:

  MODULE M_VIEWIMA  

  ...
  CHARACTER, ALLOCATABLE :: CBILD(: )
  ...

  END

In some cases I use this variable meaning that I allocate it and initialise it with char(0). Now, when I call a subroutine, there is also the module from above included, so I don’t need to declare, allocate and initialise the variable again.

All this is running since years. In particular it works on a PC with Windows XP and FTN95 version 4.0.0. In between I use another PC with Windows 7 and the actual FTN95 version, and now my routines doesn’t work anymore: In the moment when within the subroutine I try to use the variable, the programme breaks down with an error message like “failed to write to location 000000FFF” or similar. Can anyone help me? I read something about a new storage model in FTN95 – may this be the reason?

Thanks in advance Wilfried

25 Jun 2010 12:08 #6554

Wilfred,

To confirm the address you are attempting to use, I would compile with /debug to confirm the line number where it is failing, then either:-

  1. print the array index then LOC(..) to file or second screen to see what is happening, or
  2. compile with /check and use SDBG to watch the problem. You did not indicate how often this routine is/has been called. The problem you are having could possibly relate to some other previously called system service that is not working as expected with Windows 7.

Alternatively, I sometimes find it is an old mixed mode program error to be the cause. The new memory model may change the way local variables are ordered on the stack, changing what is being corrupted. This is all a guess.

I have used both memory storage models and not identified any problems like this in the past, although I only use XP.

John

25 Jun 2010 6:03 #6555

Thank you, John. I use the construction mentioned above in several subroutines within a big and complex software. With FTN95 4.0.0 and XP it works, with new FTN95 and 7 it failes in every case. I will try to isolate the problem as good as possible and then use /debug and /check as you wrote.

Regards, Wilfried

25 Jun 2010 8:42 #6556

very funny... I just took few other variables out of the module and placed them directly into the subroutine and now it works... these few variables are only used in one single subroutine, so it was not necessary to include them in a module. No idea about what was going on, but everything is running, so the weekend can come.

25 Jun 2010 9:34 #6557

That does look like a corrupt stack... some where earlier in the program. I'd be using IMPLICIT_NONE and checking for a mixed mode or array length errors (especially array(0) being defined). /CHECK can find these, although if you use fortran 77 extensions, it may be a bit of a headache.

John

Please login to reply.