Silverfrost Forums

Welcome to our forums

Illegal Pointer

24 Oct 2016 12:59 #18213

Hi I have been using FORTRAN for some time (Salford 77 and now Silverfrost Ftn95) and I am now getting an 'illegal pointer' error and thus an access violation during execution. The program has been growing slowly with no problems until now. As far as I am aware, I am not using pointers (certainly not defined, anyway) so I am wondering if anyone can shed some insight on what is/may be going on.

The code at which the problem occurs has been executed at least once before failing. The program is very basic and unsophisticated but I do need to overcome this problem to proceed.

Any comments. views, suggestions welcome!

Thanks

24 Oct 2016 1:21 #18214

Can you reduce the size of the malfunctioning program and post the source code here? If the program needs to read data files or uses include files, those will also be needed.

When a program crashes, you usually receive a traceback. Please record and provide the traceback information, since we can determine from it whether the illegal access occurred in your code, the runtime library or in the OS.

24 Oct 2016 2:55 #18220

Hi I was afraid that this would be necessary! The program has about 50 subroutines and reads data from 30 or so tables in different directories (it is a game I am working on). In addition there are saved games that need selection and loading so it would be a substantial undertaking (for me and for anyone looking at it also.

When you refer to traceback, do you refer to the list of called routines? That is certainly available.

If there is no other reasonable way to investigate the matter I will get a zipped file together; please let me know.

Thank you for your interest and help.

24 Oct 2016 2:58 #18222

Perhaps I should also add that I am operating under DOS.

24 Oct 2016 4:00 #18223

Quoted from alangr When you refer to traceback, do you refer to the list of called routines? That is certainly available.

Yes. The traceback will let you know whether the crash occurred in one of your Fortran subroutines, the Fortran RTL or the OS. Having that information would let you look at the offending routine more closely than otherwise.

25 Oct 2016 7:49 #18229

I am developing thr program using the Salford debugger, SDBG so I know just where the fault occurs. I give below the point at which it fails.

The ORGPLY routine is executed (at least) once and all seems to be OK. Then before the last HEADER call the variable P is 5 (P is not in a common block). When the problem is to happen, the HEADER call executes OK as far as the results are concerned - a screen commentary on progress) but when control comes back to the ORGPLY routine, P is already declared as an illegal pointer.

So the HEADER routine seems to do something to upset things. I have stepped through HEADER and checked the screen and I cannot see anything amiss - but clearly something odd is happening.

I tried putting P into a common block and this did allow the MENU call to work OK; but then the illegal pointer error happened in an input routine in the MENU routine.

Do you have any ideas for a way forwards from here?

Thanks!

  SUBROUTINE ORGPLY

(Text plus common blocks in INCLUDE statements. INTEGER K, I, L, P 10 CALL HEADER P=5 CALL MENU(P, K) IF(K.EQ.1) THEN ..........

30 Oct 2016 12:08 #18273

Quoted from alangr I am developing thr program using the Salford debugger, SDBG so I know just where the fault occurs.

A symbolic debugger is a useful tool, but its ability to trap machine level errors is limited. All that you can claim to know is where a fault becomes noticeable.

I give below the point at which it fails.

Again, you may know the point at which there is some indication of failure. The failure could have been initiated somewhere else -- in your code, in the FTN95 RTL or the Windows DLLs.

The string 'Illegal pointer' occurs in the debugger DLL sdbgdll.dll. If your Fortran source code does not use pointers, something is going wrong at a lower level.

It is unreasonable to expect that the bug can be understood or reproduced based on a few lines of code that you think are relevant.

If you can construct a short 'reproducer', i.e., a test Fortran source that can be compiled and run to exhibit the bug, someone may be able to help. I doubt that anyone would undertake to debug your entire game program for you, even if you were willing to provide the source code in its entirety.

30 Oct 2016 4:15 #18280

Thanks for your response: I agree with you about the unreasonableness of using simply a few lines of code but I was trying to get a feel for what might be going on. I am not sure that I am really that much clearer about the detail but thanks for your help; it is appreciated. t least I can now proceed, for a while at least.

Please login to reply.