Silverfrost Forums

Welcome to our forums

Unknown Compiler Error

20 Mar 2006 6:16 #584

Hi,

using Plato 3.15 and FTN 95 v.4.6.0 I have the following problem: On compile time I get the message:

Access violation: The instruction at address [..] attempted to read from location [..]

The [..] seem to be hexadecimal addresses. The above lines are then followed by more addresses and C type function names.

Unfortunately I cannot draw any information from that message in regards to where the problem might lie. I will probably solve it somehow this time again. But these error messages keep showing up and don't give me any info on what to do.

Thanks again for any help you can offer. 😃 Rainer

20 Mar 2006 6:38 #585

Update:

I just noticed that exactly the same version of source code compiles once with the above behaviour and once regularly without it, depending on what my latest modifications were, that is depending on how I got to that version. This is no deterministic behaviour !

In another version of the source code, however, the error appears consistently. Only if I come from that version and make certain changes, the compiler reacts in the described way.

Rainer

20 Mar 2006 8:46 #586

Rainer

If this problem is occuring at compile time then you have encountered a bug in FTN95 because it should give a sensible error message and exit cleanly for all valid and invalid Fortran code.

You can isolate the line of code in your program that is causing FTN95 to fail by changing code lines into comments until the problem is removed. There will probably be a programming error on the line of code that causes the problem.

Alternatively you can post a short program here. This will enable us to fix the bug so that others do not encounter the same problem.

20 Mar 2006 10:26 #587

I just thought I had solved the problem, but then I realized I didn't. I was using the modules 'MSWIN32' and 'MSW32PRM' in one module and reusing them directly in a routine inside a module that uses the first module. I removed the second usage in the routine and it seemed like the problem was gone.

What's really confusing is that the error doesn't appear consistently. What I described above as consistent appearance of the error in one case may not have been after all. Now, for both versions of source code that I attributed above to consistent and inconistent appearance of the problem, respectively, I get the following consistently inconsistent 😃 behaviour:

1.) I start out with either of the two source code versions, where the mentioned modules are used in my original module. The error appears. 2.) I comment out one of the two module usages in my module. I get a regular compiler error, saying that somewhere a function is undefined, which is perfectly normal. 3.) I add the outcommented line again, exactly as it has been before in step 1). Suddenly there is no compiler error at all anymore ! 4.) I make another arbitrary change to my program, save it, undo it again and save again, just so that the source code has been changed. Now it's back to step 1).

Any ideas ? 😃

Rainer

20 Mar 2006 2:09 #588

Rainer

The only way that I can help is if you post the code here for me to look at. You should first reduce the size of the program to make it as small as possible while still demonstrating the problem.

21 Mar 2006 5:12 #589

Hi Paul,

the whole code is too large and unfortunately I don't know where to look for the problem first. The above post was meant to describe in which way the compiler behaves inconsistently. I left in the part with the almost solved problem, because I had already typed the complete description in the assumption that the error was gone, when I realized that it wasn't. I will try to give as much information as I can once the problem is truly gone.

Rainer

21 Mar 2006 5:44 #590

If it helps you to know, this is the current error message I get:

Compiling file: filename.f95 Access violation: The instruction at address 0048cb75 attempted to read from location 00000000 0048c865 generate_debug_tables(void) [+0310] 004161c5 end_function(int) [+1115] 00417f94 parse_end_statement(<ptr>char,int,<ref>int) [+0b39] 00411b1f handle_token(<ptr>char,int,int,int,int,<ref>int) [+0e56] 00405263 ProcessEntireLine(void) [+068f] 0040629b compile(<ptr>char) [+00ce] 00401000 main [+05ac] 0055427a SALFStart [+06ff] eax=00000000 ebx=04d9055c ecx=ffffffff edx=00000000 esi=0383f674 edi=00000000 ebp=0383f768 esp=0383f65c IOPL=0 ds=0023 es=0023 fs=003b gs=0000 cs=001b ss=0023 flgs=00290246 [NC EP ZR SN DN NV] 0360/1820 TSTK=3 [ ] 0048cb75 repne
0048cb76 scasb

21 Mar 2006 10:49 #593

No sorry. I need the Fortran code to inteprete this.

22 Mar 2006 4:40 #597

Well, the code is too large to post here and I don't know where to look. Are you saying that one can draw information from that message about where the error is ? Could you direct me to some link on how to do this myself ?

22 Mar 2006 8:27 #598

I also wanted to ask whether there is any way to outcomment complete text blocks in whole, like in C++ with /* and */. Thanks

27 Mar 2006 10:57 #600

Ping. 😃

Any answer to the above two questions could help me very much, I guess. 😃

27 Mar 2006 12:32 #601

From the call stack trace you posted it seems the access violation occurs in the function 'generate_debug_tables'. Do you still get the access violation when compiling without any kind of debug switch?

If you are getting the problem inconsistently it could be due to having some previously compiled files or modules lingering around. Try to do a full recompile each time you test it (i.e. remove all generated files - *.obj and *.mod).

If you are still struggling to cut the code down to a small example that reproduces the problem, try to compress your code (along with a plato 3 project file or a windows batch file to build the application) into a zip file and find a site to host it. I believe there are a few sites out there that provide a free temporary hosting service. Try a search on www.google.com for 'free file host'. I haven't tried any such service, however, so can't recommend any.

27 Mar 2006 2:57 #602

Hi !

Thank you very much for your response. Your second suggestion kind of helped. Whenever I delete the MOD files before a compilation run, the problem is gone. If I don't it remains.

About your first suggestion:

Do you still get the access violation when compiling without any kind of debug switch?

That was actually the first suggestion that I tried, though I'm not exactly sure what you mean. In the project properties under 'Compiler Options->Debugging' there was only one switch activated: 'Full checking code (/CHECKMATE)'. I deactivated that and tried again - with the same problem. (That was before I got to the point of deleting the MOD files)

If it gives any additional information on what the problem may be, here is what else I did before simply deleting the MOD files. It produced a rather weird result: I had the idea to activate a few more of the flags to maybe show more compiler error messages, so I just activated all of the following flags: 'Debug information (/DEBUG)', 'Checking code (/CHECK)', 'Check for undefined variables (/UNDEF)', 'Full checking code (/CHECKMATE)', 'Full debug information (/FULL_DEBUG)', 'Array bounds checking (/BOUNDS_CHECK)' and 'Quick bounds checking (/QUICK_BOUNDS)'. Then, instead of the access violation, it showed a couple of errors, but at locations where I hadn't modified any code since I'm working on the program. It simply said that arguments to a routine call were missing, when in fact the call seemed perfectly okay.

Moreover, when I deactivated any of the flags again, the access violation was back, regardless which flag I deactivated, even if it was one that was supposed to be included in another, like /CHECK in /CHECKMATE. On one occasion, when the flag I deactivated again was 'Full debug information (/FULL_DEBUG)', I received a 'fatal error' instead of the access violation. However, when I tried to reproduce it, it was the original access violation again.

Well, at least now I have a workaround in deleting the MOD files before I compile. Thanks so far for the help. 😃

Rainer

27 Mar 2006 10:41 #603

Rainer

To 'comment out' blocks of code just select the block and click on the appropriate button on the toolbar.

28 Mar 2006 5:57 #605

Thanks everyone for the help. I upgraded to FTN95 vs. 4.9.0 and the problem seems to be gone so far.

Rainer

30 Mar 2006 4:22 #611

It's strange. I just got an email stating that a reply to this thread had been posted by the adminstrator, but when I clicked on the link and got to this forum there was no trace of that post. The email quoted the post, so I know that he was asking for the C type function names. I posted the exact error I got at one occasion in a post with the timestamp '5:44 21 Mar 2006' here: http://forums.silverfrost.com/forums/forum.asp?forumid=8&page=0&select=1294#xx1294xx

Edit: You know, people, your forum software is really weird. The view descriptions are not really intuitive, some messages are not displayed, sometimes apparently even in neither type of view and when I click on the 'link' button for a new post, my post is instead directly submitted. :p

30 Mar 2006 8:15 #612

Rainer

The forum software is third party. It is not ideal but it serves its purpose and would be difficult to replace. May I respectfully suggest that you look elsewhere for a Fortran compiler with a better support service.

30 Mar 2006 9:18 #613

Dear Paul

It seems to me I may have insulted you with my last post. If that was so, I apologize. I appreciate the work you do here, especially yours personally. AFAIK my university is still interested in sticking with the Silverfrost Fortran compiler and environment.

Rainer

Please login to reply.