View previous topic :: View next topic |
Author |
Message |
DanRRight
Joined: 10 Mar 2008 Posts: 2863 Location: South Pole, Antarctica
|
Posted: Tue May 16, 2023 7:50 am Post subject: Error reporting |
|
|
During last year FTN95 started to report numerous false positives. It can tell you that you made an error in the absolutely legit place confusing you. To start this behavior you just need to make any other error and you will get bunch of other not valid ones. Typically the bad place is also reported somewhere down the file 1000 lines below or so but today i just forgot () in declaration of function like this
integer function ReadInitialSettings ()
and got two non-existent errors in report and no actual error. This is scary. Some day you will get an error report and will not find actual error in days (ones or twice in my past career i searched for an error for entire month). The frequent backups and frequent compilations becomes a necessity
Do others noticed such behavior of FTN95 lately ? |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1896
|
Posted: Wed May 17, 2023 3:01 pm Post subject: |
|
|
You should see fewer such "false error reports" if your sources are free form rather than the old F77 fixed form.
In fixed form, if you left out the '()' in the function declaration, the compiler could conclude that the declaration is
Code: | integer functionReadInitialSettings |
In other words, that this is an integer variable declaration, and that this source line is starting a second main program unit.
To do anything about your rather general but vague complaint, it is probably necessary for you to collect and submit reproducers that are sufficient to make the compiler exhibit incorrect/implausible error messages. |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2863 Location: South Pole, Antarctica
|
Posted: Wed May 17, 2023 5:44 pm Post subject: |
|
|
The cases I was working with last year were free form sources.
One such case was fixed last year. Took me days to prepare a demo |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2863 Location: South Pole, Antarctica
|
Posted: Fri Jun 02, 2023 10:14 pm Post subject: |
|
|
Is there anything wrong with these lines?
Code: | IF(iTimesThisPlace1.GT.100.or.iTimesThisPlace2.gt.100) then
if(iTimesThisPlace.ge.iTimesThisPlace2) write(chNumbOutOfRange,'(i12)') iTimesThisPlace
if(iTimesThisPlace.lt.iTimesThisPlace2) write(chNumbOutOfRange,'(i12)') iTimesThisPlace2
if(kAllowPOPtooManyParticl.eq.1) CALL POP('Too many particles out of range='//chNumbOutOfRange//'. Switch ON checking')
ENDIF
|
Definitely not. But i am getting the error report
Code: | 17122) if(iTimesThisPlace.ge.iTimesThisPlace2) write(chNumbOutOfRange,'(i12)') iTimesThisPlace
*** Error 420: The condition in an IF statement should be scalar |
And that strange refusal to compile happens all the time since 1990 if the file reach 30-35k lines. I wrote about this few times here over these years. I was forced to split the file and all goes OK...This will be inconvenient ones again in the future because will need to introduce more modules and more modules etc.... Unbelievable no one else have seen that behavior.
Some integer*2 variable was forgotten in the compiler since 1980th? |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1896
|
Posted: Sat Jun 03, 2023 12:57 am Post subject: |
|
|
Do you have explicit declarations for the variables iTimesThisPlace and iTimesThisPlace2? Are they scalars? Functions?
It is probably not a good idea to break up a source file into smaller files and thereby disable the compiler from spotting inconsistencies in type, usage, etc., for identifiers that appear in more than one program unit. |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2863 Location: South Pole, Antarctica
|
Posted: Sat Jun 03, 2023 6:32 am Post subject: |
|
|
Yes, they are declared as integer*8 variables in main module used everywhere. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8011 Location: Salford, UK
|
Posted: Sat Jun 03, 2023 7:19 am Post subject: |
|
|
Dan
Please provide a working sample that illustrates this error report.
The following expansion does not produce an error.
Code: | character*80 chNumbOutOfRange
integer*8 iTimesThisPlace,iTimesThisPlace1,iTimesThisPlace2
integer kAllowPOPtooManyParticl
chNumbOutOfRange = ""
iTimesThisPlace = 0
iTimesThisPlace1 = 0
iTimesThisPlace2 = 0
kAllowPOPtooManyParticl = 0
IF(iTimesThisPlace1.GT.100.or.iTimesThisPlace2.gt.100) then
if(iTimesThisPlace.ge.iTimesThisPlace2) write(chNumbOutOfRange,'(i12)') iTimesThisPlace
if(iTimesThisPlace.lt.iTimesThisPlace2) write(chNumbOutOfRange,'(i12)') iTimesThisPlace2
if(kAllowPOPtooManyParticl.eq.1) CALL POP('Too many particles out of range='//chNumbOutOfRange//'. Switch ON checking')
ENDIF
end |
|
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2580 Location: Sydney
|
Posted: Sat Jun 03, 2023 1:12 pm Post subject: |
|
|
Dan,
The following example produces the error message.
Does your original code have a dimension statement somewhere ?
Code: | character*80 chNumbOutOfRange
integer*8 iTimesThisPlace,iTimesThisPlace1,iTimesThisPlace2
dimension iTimesThisPlace(2)
integer kAllowPOPtooManyParticl
chNumbOutOfRange = ""
iTimesThisPlace = 0
iTimesThisPlace1 = 0
iTimesThisPlace2 = 101
kAllowPOPtooManyParticl = 1
IF ( iTimesThisPlace1 > 100 .or. &
iTimesThisPlace2 > 100) then
if ( iTimesThisPlace >= iTimesThisPlace2) write(chNumbOutOfRange,'(i0)') iTimesThisPlace
if ( iTimesThisPlace < iTimesThisPlace2) write(chNumbOutOfRange,'(i0)') iTimesThisPlace2
if ( kAllowPOPtooManyParticl == 1) CALL POP ('Too many particles out of range= ' // &
trim (chNumbOutOfRange) // &
'. Switch ON checking')
END IF
end |
|
|
Back to top |
|
|
|