Silverfrost Forums

Welcome to our forums

Error reporting

16 May 2023 6:50 #30316

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 ?

17 May 2023 2:01 #30325

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

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.

17 May 2023 4:44 #30328

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

2 Jun 2023 9:14 #30367

Is there anything wrong with these lines?

    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

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?

2 Jun 2023 11:57 #30370

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.

3 Jun 2023 5:32 #30372

Yes, they are declared as integer*8 variables in main module used everywhere.

3 Jun 2023 6:19 #30373

Dan

Please provide a working sample that illustrates this error report.

The following expansion does not produce an error.

    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
3 Jun 2023 12:12 #30375

Dan,

The following example produces the error message. Does your original code have a dimension statement somewhere ?

    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
Please login to reply.