thompson@dalcs.UUCP (09/03/87)
Has anyone see this problem before and do they have a fix for
it?
As stated in the document `A Portable Fortran 77 Compiler' on
pages 18 and 19 (Section 3.3 PARAMETER Statement) A character
constant may be declaired with an implied length of (*), this does
not work with f77, see sample program below. The sample program
should compile according to the manual and the standard. This
program will work if I replace `(*)' with `(15)'.
Script started on Thu Sep 3 13:51:01 1987
%251% cat test.f
PROGRAM SHPROB
CHARACTER *(*) TSTSTR
PARAMETER ( TSTSTR = 'This is a test.' )
WRITE ( 6, 99999 ) TSTSTR
STOP
99999 FORMAT ( A )
END
%252% f77 test.f
test.f:
MAIN shprob:
Error on line 3 of test.f: Declaration error for tststr: illegal adjustable length character variable
Error. No assembly.
%253% exit
script done on Thu Sep 3 13:51:27 1987
--
Michael A. Thompson, Dept. Math, Stats, & C.S., Dalhousie U., Halifax, N.S.
thompson@dalcs.uucp From Bitnet or Uucp
thompson@cs.dal.cdn From Bitnet or Cdn
thompson%dalcs.uucp@uunet.uu.net From Arpair10@sdcc6.ucsd.EDU (Donald R. Fredkin) (09/04/87)
The ANSI standard (X3.9-1978) for FORTRAN states in section 8.4.2
(CHARACTER Type-Statement) that "An entity declared in a CHARACTER
statement must have a length specification that is an integer
constant expression, unless that entity is ... a character constant
that has a symbolic name... If a character constant that has a
symbolic name has a len of (*) declared, the constant assumes the
length of its corresponding constant expression in a PARAMETER
statement."
So the f77 compiler in 4.3BSD (on VAX's) is non-conforming. The
bug does not occur, according to my tests, on SUN workstations or
on the Celerity 1260.
--
UUCP {ihnp4,decvax!ucbvax,dcdwest,ucbvax}!sdcsvax!ra!drf
Internet drf%ra@sdcsvax.ucsd.edu