View previous topic :: View next topic |
Author |
Message |
Rainer
Joined: 13 Mar 2006 Posts: 43
|
Posted: Mon Mar 20, 2006 7:16 am Post subject: Unknown Compiler Error |
|
|
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 |
|
Back to top |
|
|
Rainer
Joined: 13 Mar 2006 Posts: 43
|
Posted: Mon Mar 20, 2006 7:38 am Post subject: Unknown Compiler Error |
|
|
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 |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7932 Location: Salford, UK
|
Posted: Mon Mar 20, 2006 9:46 am Post subject: Unknown Compiler Error |
|
|
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. |
|
Back to top |
|
|
Rainer
Joined: 13 Mar 2006 Posts: 43
|
Posted: Mon Mar 20, 2006 11:26 am Post subject: Unknown Compiler Error |
|
|
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
|
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7932 Location: Salford, UK
|
Posted: Mon Mar 20, 2006 3:09 pm Post subject: Unknown Compiler Error |
|
|
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. |
|
Back to top |
|
|
Rainer
Joined: 13 Mar 2006 Posts: 43
|
Posted: Tue Mar 21, 2006 6:12 am Post subject: Unknown Compiler Error |
|
|
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 |
|
Back to top |
|
|
Rainer
Joined: 13 Mar 2006 Posts: 43
|
Posted: Tue Mar 21, 2006 6:44 am Post subject: Unknown Compiler Error |
|
|
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 |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7932 Location: Salford, UK
|
Posted: Tue Mar 21, 2006 11:49 pm Post subject: Unknown Compiler Error |
|
|
No sorry. I need the Fortran code to inteprete this. |
|
Back to top |
|
|
Rainer
Joined: 13 Mar 2006 Posts: 43
|
Posted: Wed Mar 22, 2006 5:40 am Post subject: Unknown Compiler Error |
|
|
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 ? |
|
Back to top |
|
|
Rainer
Joined: 13 Mar 2006 Posts: 43
|
Posted: Wed Mar 22, 2006 9:27 am Post subject: Unknown Compiler Error |
|
|
I also wanted to ask whether there is any way to outcomment complete text blocks in whole, like in C++ with /* and */.
Thanks |
|
Back to top |
|
|
Rainer
Joined: 13 Mar 2006 Posts: 43
|
Posted: Mon Mar 27, 2006 11:57 am Post subject: Unknown Compiler Error |
|
|
Ping.
Any answer to the above two questions could help me very much, I guess. |
|
Back to top |
|
|
Martin
Joined: 09 Sep 2004 Posts: 43
|
Posted: Mon Mar 27, 2006 1:32 pm Post subject: Unknown Compiler Error |
|
|
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.
|
|
Back to top |
|
|
Rainer
Joined: 13 Mar 2006 Posts: 43
|
Posted: Mon Mar 27, 2006 3:57 pm Post subject: Unknown Compiler Error |
|
|
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
|
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7932 Location: Salford, UK
|
Posted: Mon Mar 27, 2006 11:41 pm Post subject: Unknown Compiler Error |
|
|
Rainer
To "comment out" blocks of code just select the block and click on the appropriate button on the toolbar.
|
|
Back to top |
|
|
Rainer
Joined: 13 Mar 2006 Posts: 43
|
Posted: Tue Mar 28, 2006 6:57 am Post subject: Unknown Compiler Error |
|
|
Thanks everyone for the help.
I upgraded to FTN95 vs. 4.9.0 and the problem seems to be gone so far.
Rainer |
|
Back to top |
|
|
|