Xref: utzoo comp.unix.questions:4816 sci.math.stat:223 Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!ptsfa!ames!hao!oddjob!mimsy!cvl!umd5!brl-adm!cmcl2!husc6!rutgers!bellcore!faline!ulysses!allegra!alice!rab From: rab@alice.UUCP Newsgroups: comp.unix.questions,sci.math.stat Subject: Re: Problems with S statistical package Summary: Sun fortran compiler bug Keywords: S AT&T Sun-3 SunOS 3.4 Message-ID: <7540@alice.UUCP> Date: 16 Dec 87 11:20:50 GMT References: <162@iesd.uucp> Organization: AT&T Bell Laboratories, Murray Hill NJ Lines: 86 Posted: Wed Dec 16 06:20:50 1987 In article <162@iesd.uucp>, jpc@iesd.UUCP writes: > Could anyone please shed light on a problem I have in compiling the S > statistical package from AT&T on our Sun-3 system: > > System specifics: Sun 3/260 under SunOS 3.4 using the m4 macro > processor supplied with the S system. S version date: Fri Feb 28 1986 > > > 1 + 2 > Bad operator: + > Error in + > > So, have *anybody* made this run on a Sun system, and how did you do it? You have stumbled across a bug in the f77 compiler in Sun's 3.4 release. Others have gotten around the problem by re-installing f77 from the 3.2 release. Sun says they will fix the problem soon -- you might want to check with them. Here is the bug report that I sent to Sun: __________________________________________________ On pg 89 of Release 3.4 Manual for the Sun Workstation, Part 800-1614-10, Revision A of 14 May, 1987, listed under "incorrect handling of Backslash characters" is the following: Previously, f77 did not correctly handle the backslash character (\). It converted a double backslash (\\) to a single backslash, requiring you to type four backslashes (\\\\) for a double backslash. The compiler converted \0 to the ASCII character 0, which is the string terminator for C, rather than FORTRAN. THis has been fixed in Release 3.4. Whoever "fixed" this bug should read page 89 of the Fortran Programmer's Guide, Part 800-1371-02, Revision E of 17 February, 1986. It states: For compatibility with C usage, the following backslash escapes are recognized: and then has Table 6-1 that shows backslash escape sequences including \\ and \0. These escapes are extremely important to Fortran programmers that are communicating with C. For example, they are the only way to get null-bytes into character strings that are initialized by data statements. Here's a simple example: character *100 foo data foo/"this is a test string\0"/ call bar(foo) stop end Here is the C function bar: bar_(s,l) char *s; long l; { printf("The string is: %s\n",s); printf("its actual length is %ld but its declared length is %ld\n", strlen(s),l); } Here's the result on a Sun OS 3.2 system. $ f77 foo.f bar.c foo.f: foo.f: MAIN: bar.c: Linking: $ a.out The string is: this is a test string its actual length is 21 but its declared length is 100 Here's the result on a Sun OS 3.4 system. $ f77 foo.f bar.c foo.f: foo.f: MAIN: bar.c: Linking: $ a.out The string is: this is a test string The string is: %s its actual length is 118 but its declared length is 100 -- Rick Becker alice!rab research!rab