Silverfrost Forums

Welcome to our forums

FTN95 fails to generate error for duplicate labels

4 Jul 2020 10:40 #25899

A trivial example, but at least two other fortran compilers reject this code due to duplicate labels:-

  program test
  
  loop1 : do i = 1, 10, 1
            print*, i
          end do loop1

  loop1 : do i = 1, 10, 1
            print*, i
          end do loop1
          
  end program test

So I can compile and run this contrived code in FTN95 - and start a debate about where the exit statements should jump to:-

  program test
  loop1 : do i = 1, 10, 1
  loop1 :   do j = 1, 10, 1
              print*, i, j
              if (j .eq. 5) exit loop1 
            end do loop1
            if (i .eq. 2) exit loop1
          end do loop1
  end program test
5 Jul 2020 2:14 #25900

I've seen the quote that you can write Fortran in any language, but this is the first time I've seen Algol written in Fortran!

Eddie

6 Jul 2020 6:52 #25906

Algol 60 lacked standard I/O, so one has to stoop to something!

'Algol 60 at 60': https://www.theregister.com/2020/05/15/algol_60_at_60/

6 Jul 2020 8:11 #25910

Ken

Thank you for the bug report which I have logged.

7 Jul 2020 9:36 #25922

This bug has now been fixed for the next release of FTN95.

7 Jul 2020 10:20 #25923

Algol 60 lacked standard I/O

So true, but did it matter when the Algol on various manufacturers' machines was so different anyway? (Notably in the way that reserved words were highlighted).

And although Fortran IO was standard, the concentration on making it look like Algol* stopped progress (if any was envisaged) on graphics and other than primitive user interfaces until FTNxx, starting with DBOS and then with CW+.

Eddie

*long source code lines, getting rid of statement numbers, indenting, various loop types, lower case, labels (as in this topic), just to mention a few ...[/quote]

Please login to reply.