 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
DanRRight
Joined: 10 Mar 2008 Posts: 2923 Location: South Pole, Antarctica
|
Posted: Thu Aug 09, 2012 8:04 am Post subject: Wrong warning |
|
|
I get a lot of warnings of truncated lines in the lines where exclamation mark is posted even after 72 position (!) like in example here
Code: | integer,dimension(:),save,allocatable,target :: itjpo_1,ispar_1 ! 101022 |
It does not hurt but i think better to fix this warning because if there are many of them you can miss real truncated line |
|
Back to top |
|
 |
davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Thu Aug 09, 2012 5:57 pm Post subject: |
|
|
To be fair, you shouldn't put anything after column 72, even a comment.
(in the old days you could put a sequence number in there in case you dropped your cards).
You can remove the 72 column limit using the option /WIDE_SOURCE
Or you can leave the 72 column limit in place and just disable the warning by using the /NO_WARN_WIDE option.
You will have to play and see which works for you. Personally, I get my editor to check for "long lines" so I never have this problem at compile time. _________________ Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl |
|
Back to top |
|
 |
DanRRight
Joined: 10 Mar 2008 Posts: 2923 Location: South Pole, Antarctica
|
Posted: Fri Aug 10, 2012 1:12 am Post subject: |
|
|
All these workarounds are an invitation for disaster, David. Formally, we are allowed to put comment with exclamation mark in any place, so the compiler should treat that correctly.
This is large legacy code, it is not mine, it uses 72 char default limit and i permanently catch errors associated with over-the-limit use of variables with this specific compiler as the code evolves since the authors own ones (many other compilers) do not care about this and a lot of other potential bugs (as we well know that from polyhedron site). As a result instead of checking 1-2 real warning instances i have to look at hundreds. This is because just one such error -- and you will never find why the results are bad. So these warning could be deadliest errors.
Besides the compiler reports truncated lines with extreme ambiguity. Look at the code (use tab before print*)
Code: |
print*,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' !ccccc
print*,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' !ccccc
print*,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' !ccccc
!X print*,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' !ccccc
! print*,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' !ccccc
! print*,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' !ccccc
end |
It goes with no errors or warnings. But if you remove just one comment marked X even the diagnostics is completely wrong: "WARNING - There are (at least) 2 truncated line(s) in this file" (!!!).
By the way, i also like exclamation comments put anywhere i want
Last edited by DanRRight on Fri Aug 10, 2012 10:21 am; edited 4 times in total |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Fri Aug 10, 2012 6:35 am Post subject: |
|
|
I have logged this for investigation. |
|
Back to top |
|
 |
DanRRight
Joined: 10 Mar 2008 Posts: 2923 Location: South Pole, Antarctica
|
Posted: Mon Aug 13, 2012 8:54 am Post subject: |
|
|
That over-reporting of real breakouts of 72 character limit literally kills me. There are thousands of them FTN95 reports in the code i try to use, most are wrong ones caused by incorrect treatment of line width with exclamation mark used. The F77 compiler (or G77 i do not remember) code authors use is so bad that it does not stops even if it you get over the limit with such statements cutting some letters in THEN like in the ecxample line here
IF (asddsfgdfgdfgdffdsdfsdf.GT.sdfdfgdfdfgdfggdfgdfg (sdfdfgdfgddfdfdfdf+1) THEN
It does not stop if the variable is in implicit none list and is cut. It does not stop with the line missing the end of character variable....total disaster. I have tried to push them to use FTN95 but you all know it is impossible to move people to use other compilers. So, Paul, please look at this ASAP, years go and i still can not make the code working with this compiler. I can not use other compiler for this code when i see how dumb and buggy this POS is. Clearly, such bad compilers are not usable for large codes |
|
Back to top |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2402 Location: Yateley, Hants, UK
|
Posted: Mon Aug 13, 2012 8:44 pm Post subject: |
|
|
It looks to me like a conflict between the checks done for Fortran 77 and earlier, with the checks done for Fortran 90 and later. In Fortran 77 we don't have the ! comment, so going over 72 columns is forbidden, whereas in Fortran 90 with a ! comment the statement goes on until the CR LF sequence.
Perhaps the logical thing is to consider a statement as terminated by a ! comment for length computation purposes, as the comment cannot be followed by executable statements on the same line because ; would be considered part of the comment - rather than considering the statement to be extended to the end of the comment, which is what appears to be done.
I've been putting & in column 73 and changing my continuation characters to & so that my code is future-proof, and & in column 73 doesn't seem to trigger the adverse reaction that Dan has received.
Eddie |
|
Back to top |
|
 |
DanRRight
Joined: 10 Mar 2008 Posts: 2923 Location: South Pole, Antarctica
|
Posted: Tue Aug 14, 2012 5:40 am Post subject: |
|
|
This problem solution is simple. With 72 or 132 char limits the line should not be considered truncated if any letters in the line end within these limits AND the ! sign. Spaces and tabs between last letter and ! sign should not be considered as violators of limits opposed to what seems is going on right now. Well, unless i do not see some pitfalls from Fortran66 ages
Thanks for hints to make future-proof sources, Eddie, i was also experimenting somewhere in this direction. |
|
Back to top |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2402 Location: Yateley, Hants, UK
|
Posted: Tue Aug 14, 2012 10:23 am Post subject: |
|
|
Not an original idea from me, just following what I saw in the INC files. As usual, someone at Silverfrost (or Salford) was pretty smart. I do miss my 1,2,3 ... and a,b,c ... continuations, but I don't think I'll every drop a box full of 80 column cards again (like I once did on the 5th floor of a staircase with open treads!).
Eddie
[PS - I don't write code like this, but when it is working, I tidy it up so that the programs compile in fixed or free format. I don't go over the 80 columns of a card, as on A4 paper I can print smaller, but then I can't read it! The column 7 start and statement numbers look like 'outdents' to me - which I like] |
|
Back to top |
|
 |
DanRRight
Joined: 10 Mar 2008 Posts: 2923 Location: South Pole, Antarctica
|
Posted: Sat Aug 18, 2012 6:47 am Post subject: |
|
|
I see GNU Fortran neglects exclamation marks as comments in Format statements
Code: |
Format(' These over 72 character warnings will kill me !!')
|
I do not know what standard says about that exclusion in Format but it looks logical -- we will need a lot exclamation marks there.
Hollerith 1H! in Format statement also should treat ! sign as !, not as a comment
Another option which might have even more common sense is to disregard exclamation signs as comments marks between two apostrophes in any place. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|