pgf77 fails to compile a "hello, world"-like FORTR

First, the simple FORTRAN 77 code

      PROGRAM EX
      IMPLICIT NONE
      INTEGER I
      I = 1234
      WRITE(*,10) I
   10 FORMAT(  1X,'I JUST WANT TO PRINT A QUITE SIMPLE INTEGER ! ',I4/2X
     1  ' BUT PGI COMPILER FAILS HERE!')
      STOP
      END

But pgf77 fails to compile it.

$ pgf77 ex.f 
NOTE: your trial license will expire in 14 days, 14.3 hours.
PGFTN-S-0029-Illegal hexadecimal constant: BUTPGICOMPILERFAILSHERE! (ex.f: 6)
PGFTN-S-0034-Syntax error at or near non-decimal constant 0 (ex.f: 6)
PGFTN-S-0218-Statement labeled 10 is not a FORMAT (ex.f)
  0 inform,   0 warnings,   3 severes, 0 fatal for ex
PGFTN/x86-64 Linux 14.6-0: compilation completed with severe errors

I can make my simple FORTRAN 77 code to be suitable for pgf77, but it’s better to fix the parser related parts of pgf77.

BTW, it’s better to have just a trial license. Otherwise, it would be a waste of money!

Hi Xinwu,

You’re missing a comma after the “I4/2X”. Also, make sure your continuation character is in column 6 (it looks like it might be in column 7) and you don’t use more than 72 characters per line.

Hope this helps,
Mat

% cat test.f
      PROGRAM EX
      IMPLICIT NONE
      INTEGER I
      I = 1234
      WRITE(*,10) I
   10 FORMAT( 1X,'I JUST WANT TO PRINT A QUITE SIMPLE INTEGER !',I4/2X
     1  ,' BUT PGI COMPILER FAILS HERE!')
      STOP
      END
% pgf77 test.f -V14.6; a.out
 I JUST WANT TO PRINT A QUITE SIMPLE INTEGER !1234
   BUT PGI COMPILER FAILS HERE!
FORTRAN STOP

Hi,

sorry for the missing comma in line 7 of my code.

After referring to the FORTRAN 77 standard, I found my code doesn’t comply the standard syntax due to the missing comma in the FORMAT statement. Some other compilers just let it be compiled without a warning, which is not really good.

To purchase a real copy should be worthy! Hopefully, I can convince my boss.

xinwu