Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!convex!news From: dodson@convex.COM (Dave Dodson) Newsgroups: comp.lang.fortran Subject: Re: MS-FORTRAN bug in string concatenation Message-ID: <1991Feb14.185049.3535@convex.com> Date: 14 Feb 91 18:50:49 GMT References: <2PWGG2@MPLVAX.SRI.COM> Sender: news@convex.com (news access account) Reply-To: dodson@convex.COM (Dave Dodson) Organization: Convex Computer Corporation; Richardson, TX Lines: 25 Nntp-Posting-Host: mozart.convex.com In article <2PWGG2@MPLVAX.SRI.COM> HUESTIS@MPLVAX.SRI.COM (David L. Huestis) writes: >Under Microsoft FORTRAN the following simple program > > character string*4/'abc'/ > string = '*'//string > write(*,*)string > end > >produces the output '**bb' while LAHEY and VAX yield '*abc' > >Microsoft FORTRAN takes no precautions against the source strings >overlapping the destination string. The above program is non-standard. In a standard-conforming program, string variables cannot appear on both the left- and right-hand side of an assignment statement. A Fortran compiler can do anything with a non-standard program, including, but not restricted to, giving an error message, compiling and giving some "reasonable" answer, or compiling and giving an unreasonable answer. Different implementations that compile and give some reasonable result may choose different reasonable results. ---------------------------------------------------------------------- Dave Dodson dodson@convex.COM Convex Computer Corporation Richardson, Texas (214) 497-4234