Silverfrost Forums

Welcome to our forums

error messaging

18 Jun 2020 7:23 #25703

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.

19 Jun 2020 6:58 #25704

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.

19 Jun 2020 7:06 #25705

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:

      WHILE(ctrl.LT.0)DO.0

The compiler gives the following error message:

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:

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.

19 Jun 2020 2:27 #25713

You eyes are sharp: fewer words but more informative!

20 Jun 2020 9:09 #25727

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

21 Jun 2020 2:07 #25732

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

write(6,'(' Enter the 1' aluminum disk radius (in): ',$)')
end

the compiler reports:

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 '***'.

21 Jun 2020 2:18 #25734

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.

21 Jun 2020 2:49 #25736

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.

21 Jun 2020 3:12 #25737

I found Version 7.0 on an older PC. Here is what it said for the same two-line program as above:

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.

21 Jun 2020 6:34 #25739

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.

21 Jun 2020 9:08 #25741

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. 😃

22 Jun 2020 9:29 #25747

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]

22 Jun 2020 9:59 #25748

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.

22 Jun 2020 9:48 #25762

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.

23 Jun 2020 8:04 #25766

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 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 ftn95 filename.f

my ftn95.cfg file is /ERROR_NUMBERS /IMPLICIT_NONE /INTL /LOGL

The compiler response is [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 [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: 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 ?

     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 [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: 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:141baf685f]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.

23 Jun 2020 3:25 #25769

John C. I intentionally created the errors to check compiling! I realize there should not be .. in the do statement. /brief cures the problem. Without it, the command window does not give line numbers for errors. My previous post of yesterday explains the solution with creation a .CFG file that listed all source code with errors (in filenam.lis) displayed following the incorrect code statement.

23 Jun 2020 5:47 #25771

Yes John Silver. I removed both options you noted and the compile error line number did show up in the Command window. The only option in my .cfg file was reduced to /BRIEF However without /BRIEF, the line number does not show up in the Command window. Oh well. I am quite satisfied I have a working method to obtain useful error messages. Thanks for the inputs.

24 Jun 2020 2:51 #25776

Quoted from offthechart However without /BRIEF, the line number does not show up in the Command window.

I do not agree with this claim. The offending line + line number appears without /brief. My experience is that it is preferable to not use /brief and until a working example is provided to demonstrate line numbers are not provided, I would recommend ignoring ofthechart's recomendations.

( I prefer to also use /ERror_numbers to better identify the errors and warnings. It is also useful, should use of /IGnore be required )

24 Jun 2020 9:33 #25779

I agree with John C's comment, with one caveat: the next-to-zero chance that Offthechart's licensed version of FTN95 7.0 hides line numbers whereas the personal versions of 6.35, 7.0, 7.2 and 8.62 that I used do not hide line numbers.

24 Jun 2020 3:01 #25782

OK gang, here goes for the last time. For whatever &$* reason, /ftn95 filename.f in my command window does not show error line numbers. I am not an unobservant idiot. As a previous long time analyst in the defense world and member of the Triplenine society, not much gets by me.

Get it? I don't know why, but that is what occurs when I compile. When I add /BRIEF line numbers show up in the command window. Great. When I create a ftn95.cfg file with /LIST included I get a full source file printout (filename.lis) with the error message following each errant statement. Excellent. I don't have the slightest idea about the inner workings of the maze named Silverfrost, but in general I am quite pleased with it.

I do not have a licensest version as I only create code at home when the desire strikes me. For example, a retired math friend wished to solve polynomial equations with complex coefficients. I discovered the Laguer method and successfully coded it. Or a barroom question: I wonder how much farther a home run travels in Denver versus San Francisco? Having discovered Internet data on drag and lift (Magnus) coefficients, off I went into the land of numerical integration. Keeps my 75 year-old mind working. Thanks for help y'all.

Please login to reply.