View previous topic :: View next topic |
Author |
Message |
offthechart
Joined: 04 Dec 2013 Posts: 17
|
Posted: Thu Jun 18, 2020 8:23 pm Post subject: error messaging |
|
|
Simple request. I currently compile with ftn95 filename.f
The errors do not include line numbers of the infraction. Since some of the error messages are rather 'obtuse' is there a way of getting the offending line number printed? Thanks. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8037 Location: Salford, UK
|
Posted: Fri Jun 19, 2020 7:58 am Post subject: |
|
|
If you run FTN95 from a command line then the line and its number are printed.
If you are compiling from Plato or Visual Studio then the errors are displayed in the "Output" window. If you can't see this window then go to the View menu and select view Output. |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1897
|
Posted: Fri Jun 19, 2020 8:06 am Post subject: |
|
|
I am puzzled by your not seeing line numbers. The format used for displaying syntax errors (and the program listing, if requested) may be modified by the compiler options that are in effect (those specified at the command line, those in FTN95.CFG and directives in the source file).
Here is an example of compiling from the command line. I have a program in which line-113 contains ".0" added to the end of a WHILE (cond) DO statement:
Code: | WHILE(ctrl.LT.0)DO.0 |
The compiler gives the following error message:
Code: | 0113) WHILE(ctrl.LT.0)DO.0
*** Invalid characters after DO statement
1 ERROR [<DOUBLE> FTN95 v8.62.1]
*** Compilation failed |
As you can see, the message contains the line number, followed by the body of the offending line(s) of code, the text of the error message, and the name of the program unit ("double").
If I use the /Brief option on the same code, I see the following:
Code: | ERROR S:\LANG\FTN95\cbk.F 113: Invalid characters after DO statement
1 ERROR [<DOUBLE> FTN95 v8.62.1] |
which is in a more compact format, and displays the name of the source file as well.
Please provide an example of an error message without a line number if you still see one, and provide information on the compiler version and options that you used. |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1897
|
Posted: Fri Jun 19, 2020 3:27 pm Post subject: |
|
|
You eyes are sharp: fewer words but more informative! |
|
Back to top |
|
|
offthechart
Joined: 04 Dec 2013 Posts: 17
|
Posted: Sat Jun 20, 2020 10:09 pm Post subject: error message |
|
|
OK. I intentionally created this error:
write(6,"(' Enter the 1" aluminum disk radius (in): ',$)")
The xtra " is an error. Here is what I got:
***"Unterminated character constant"
1 error [main program FTN95/Win32 v7.00.01]
***compilation failed
No line number given at all. This is what I meant by 'obtuse'. Thanks |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1897
|
Posted: Sun Jun 21, 2020 3:07 am Post subject: |
|
|
The source line with the error, prefixed with the line number, is printed just preceding the text of the error message.
For the source file
Code: | write(6,"(' Enter the 1" aluminum disk radius (in): ',$)")
end |
the compiler reports:
Code: | S:\LANG\FTN95\Bugs>ftn95 xtra.f90
[FTN95/Win32 Ver. 8.62.1 Copyright (c) Silverfrost Ltd 1993-2020]
0001) write(6,"(' Enter the 1" aluminum disk radius (in): ',$)")
*** Unterminated character constant
0002) end
COMMENT - The main program starting on this line does not have any executable statements
1 ERROR, 1 COMMENT [<main program> FTN95 v8.62.1]
*** Compilation failed |
You can see the line number 0001) displayed on the line preceding the error message line containing '***'. |
|
Back to top |
|
|
offthechart
Joined: 04 Dec 2013 Posts: 17
|
Posted: Sun Jun 21, 2020 3:18 pm Post subject: |
|
|
I don't have version 8.6. I have version 7.0. Maybe that is the difference, but line numbers do no appear anywhere in the compile error, unlike what you just showed. Thanks but my command line has none of your example. |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1897
|
Posted: Sun Jun 21, 2020 3:49 pm Post subject: |
|
|
Other than the version number in the copyright line, I get the same output from versions 6.35 and 7.2.
It may help if you describe what steps you take -- with details of opening a command window, setting the environment for FTN95, and compiling the test source; the contents of FTN95.cfg in the FTN95 base directory. Or, if you are using Plato, Visual Studio or another IDE, information regarding that. |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1897
|
Posted: Sun Jun 21, 2020 4:12 pm Post subject: |
|
|
I found Version 7.0 on an older PC. Here is what it said for the same two-line program as above:
Code: | S:\LANG\FTN95\Bugs>ftn95 xtra.f90
[FTN95/Win32 Ver. 7.00.0 Copyright (c) Silverfrost Ltd 1993-2013]
0001) write(6,"(' Enter the 1" aluminum disk radius (in): ',$)")
*** Unterminated character constant
0002) end
COMMENT - The main program starting on this line does not have any executable statements
1 ERROR, 1 COMMENT [<main program> FTN95/Win32 v7.00.0]
*** Compilation failed |
A compiler that did not associate source line numbers with error messages would be nearly useless; if FTN95 ever had that deficiency, we would certainly have heard from a number of users about that by now. |
|
Back to top |
|
|
offthechart
Joined: 04 Dec 2013 Posts: 17
|
Posted: Sun Jun 21, 2020 7:34 pm Post subject: |
|
|
Yes, mecej4 I have been successfully compiling and running many programs on version 7.00 for years. I use ftn95 and slink on the command line . I do not recall setting any environment. When I open the command screen it states,
"Setting environment for FTN95 for Microsoft.net and win32".
Then I get the prompt C:\...\..\ etc. > and off I go to FTN95 filename.f
I am running Windows 7 with 64 bit machine.
You are right without line numbers it is silly. |
|
Back to top |
|
|
offthechart
Joined: 04 Dec 2013 Posts: 17
|
Posted: Sun Jun 21, 2020 10:08 pm Post subject: |
|
|
Well I found that by typing ftn95 filename.f/brief on the command line, the compiler listed the line number before describing the 'unterminated character constant" error. Hopefully this is a solution. Thanks to all for responding. |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2593 Location: Sydney
|
Posted: Mon Jun 22, 2020 10:29 am Post subject: |
|
|
offthechart,
Could you please provide your complete cut down code example in a [code box], together with a trace of the compile option, say as:
ftn95 offthechart.f (your options) /echo > offthechart.log
I would like to understand what options are supressing the line number from being identified.
John Campbell
[/code] |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1897
|
Posted: Mon Jun 22, 2020 10:59 am Post subject: |
|
|
As John C. wrote, it would be interesting to see the code, and putting it in a code-box is better than inline.
However, sometimes odd compiler behaviour is caused by the presence in the source code of stray tabs, form feeds, carriage returns, backspaces and other invisible characters. For such cases, a link should be provided for obtaining a true byte-for-byte copy of the original file. |
|
Back to top |
|
|
offthechart
Joined: 04 Dec 2013 Posts: 17
|
Posted: Mon Jun 22, 2020 10:48 pm Post subject: |
|
|
OK Mr. C and mecej4, here is some info.
First I created ftn95.cfg (I have never had one created) with options;
/BRIEF
/ERRORLOG
/LIST
Then compiling on the Command line I get a file created on disk -- filename.lis
It has my 2 induced errors and prints out a file with the full source code and:
0022 write(6,"(' Enter the 1" in. aluminum disk radius (in): ',$)")
ERROR C:\...\tempnewsilverfrst\filename.F 22: Unterminated character constant
and also,
0079 do i = 1,..ltot-1
ERROR C:\......\tempnewsilverfrst\filename.F 79: There is no declaration for user-defined operator '..'
Success.
Note that it takes, ftn95 filename.f/brief to get line numbers showing up in the Command prompt window. Otherwise my Command window does not display error line numbers.
Otherwise, I do not know exactly what else you might wish to see. I am not well versed in the ins and outs of compiler operation. I am a retired (13 years) engineer that specialized in structural dynamics, spectral analysis and finite element theory. I wrote many thousands of lines of code to turn physics into numbers. I still enjoy writing. Thanks for your help. If you need more info I will try. |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2593 Location: Sydney
|
Posted: Tue Jun 23, 2020 9:04 am Post subject: |
|
|
I am having trouble understanding this thread.
I can not reproduce your problem with the line of code identified producing an error message as you describe or failing to identify the line number.
My example code (which hopefully identifies a fix to your problem is Code: | write(*,"(' Enter the 1" in. aluminum disk radius (in): ',$)")
write(*,"(' Enter the 1"" in. aluminum disk radius (in): ',$)")
end |
I went back to FTN95 Version 7.00 and used the compile option
my ftn95.cfg file is Code: | /ERROR_NUMBERS
/IMPLICIT_NONE
/INTL
/LOGL |
The compiler response is Code: | [FTN95/Win32 Ver. 7.00.0 Copyright (c) Silverfrost Ltd 1993-2013]
Licensed to: John Campbell
Organisation: xxxxxxxxx
0001) write(*,"(' Enter the 1" in. aluminum disk radius (in): ',$)")
*** Error 70: Unterminated character constant
1 ERROR [<main program> FTN95/Win32 v7.00.0]
*** Compilation failed |
If I use ftn95 filename.f /brief, I get Code: | [FTN95/Win32 Ver. 7.00.0 Copyright (c) Silverfrost Ltd 1993-2013]
Licensed to: John Campbell
Organisation: xxxxxxxxx
ERROR c:\temp\filename.F 1: 70: Unterminated character constant
1 ERROR [<main program> FTN95/Win32 v7.00.0]
*** Compilation failed |
In both cases, line 1 is identified as the error line.
Without /brief, the error line of code is identified and listed.
By including /brief /errorlog, the error is also listed in filename.ERR as: Code: | ERROR c:\temp\filename.F 1: 70: Unterminated character constant |
The line number is always identified.
Also, what is "do i = 1,..ltot-1" ?
Is .. copying PLATO's representation of 2 blanks ?
Quote: | Otherwise, I do not know exactly what else you might wish to see. I am not well versed in the ins and outs of compiler operation. I am a retired (13 years) engineer that specialized in structural dynamics |
We would like to see the code, so we could attempt to reproduce your problem. I am also an engineer that specializes in structural dynamics so I don't think that relates to the problem being reported. |
|
Back to top |
|
|
|