This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Fortran help


Hi Steve

Please find the below code which has been tested successfully using f77, but fails on the FORMAT statement when trying to compile with gfortran. Hope this helps. Thanks much in advance.

PROGRAM TESTGE

      INTEGER TESTLEN
          PARAMETER (TESTLEN = 4)

      CHARACTER*(1*TESTLEN) ANS

      WRITE(*,*) "enter a string",TESTLEN," chars long"
      READ (*,100) ANS
  100 FORMAT(A<1*TESTLEN>)
      WRITE(*,*) "The string entered was: ",ANS

          END

With Regards

Vardhan

-----Original Message-----
From: Steve Kargl [mailto:sgk@troutmask.apl.washington.edu]
Sent: Thursday, July 31, 2008 11:07 AM
To: Vardhan, Sundara (GE Infra, Energy)
Cc: fortran@gcc.gnu.org
Subject: Re: Fortran help


On Thu, Jul 31, 2008 at 08:58:29AM -0400, Vardhan, Sundara (GE Infra, Energy) wrote:
> 
> I am porting code to GCC set of compilers. Recently compiled and
> installed gcc 4.2.3 and gfortran. I have legacy fortran code which
> errors out on compiling with gfortran but works with g77
> 
> 9095 FORMAT(A<1*RT_MB_MAXMB>)
>               1
> Error: Unexpected element in format string at (1)
> 
> Where RT_MB_MAXMB has been #defined. This value may change
> based on the product implementation etc, hence the requirement
> of the above statement. Is there anyway to fix this in gfortran.
> 

Send a complete, small, self-contained example of the problem.
Show the command lines you use to compile that complete, small,
self-contained example.

-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]