Path: utzoo!attcan!uunet!aplcen!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!mips!gumby!lilian From: lilian@mips.COM (Lilian Leung) Newsgroups: comp.sys.mips Subject: Re: Fortran compiler bug? Summary: Documented restriction on Mips FORTRAN Message-ID: <39069@mips.mips.COM> Date: 25 May 90 18:39:05 GMT References: <149@snll-arpagw.UUCP> Sender: news@mips.COM Distribution: na Lines: 50 In article <149@snll-arpagw.UUCP>, dandy@snll-arpagw.UUCP (David Dandy) writes: > I ported a public domain Fortran code to my DECstation 3100, and received > an f77 compiler error associated with a WRITE statement. Eliminating all but > the essential code, the offending subroutine looks like > > SUBROUTINE SKTEST ( LOUT, LINE, ILEN ) > IMPLICIT DOUBLE PRECISION ( A-H, O-Z ), INTEGER ( I-N ) > CHARACTER LINE*(*) > WRITE (LOUT, '(A)') > 1 'Error in SKSNUM...'//LINE(:ILEN)//' not found...' > RETURN > END ... > > Whether or not this is a bug with the MIPS 2.1 compiler, I have to admit > that I don't know what the WRITE statement is supposed to be doing (even > afters reading Wagener's explanation). Does anyone know a work-around to > this problem? I need to get this working before MIPS releases their next > compiler version. Is this a bug, or is it not "standard F77"? Please > respond by e-mail if you know of a fix or a work-around. It's frustrating > to RTFM and still not be sure what's going on. The above is a documented restriction on MIPS and ANSI FORTRAN. In Mips's Part II: FORTRAN Language Reference manaul, page 3-8, it states that "Except in a character assignment statement, concatenation of an operand with an asterisk(*) as its length specification is not allowed unless the operand is the symbolic name of a constant." In ASNI X3.9-1978 FORTRAN, page 6-8, it says the same thing. We will input this as a request for enhancement to our FORTRAN compiler. Meanwhile, the workaround is to assign LINE(:ILEN) to a local character variable with constant length specified and use that variable in your write statement, like this: SUBROUTINE SKTEST ( LOUT, LINE, ILEN ) IMPLICIT DOUBLE PRECISION ( A-H, O-Z ), INTEGER ( I-N ) CHARACTER LINE*(*) CHARACTER*100 TEMP TEMP = LINE WRITE (LOUT, '(A)') 1 'Error in SKSNUM...'//TEMP(:ILEN)//' not found...' RETURN END -- UUCP: {ames,decwrl,prls,pyramid}!mips!lilian (or lilian@mips.com) DDD: 408-991-7848 Lilian Leung (or 408-720-1700, Ext. 848) USPS: MIPS Computer Systems, 930 Arques, Sunnyvale, CA 94086-3650