Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!agate!violet.berkeley.edu!jerry From: jerry@violet.berkeley.edu ( Jerry Berkman ) Newsgroups: comp.lang.fortran Subject: Re: little problem Message-ID: <1989Sep11.174141.3097@agate.berkeley.edu> Date: 11 Sep 89 17:41:41 GMT References: <1349@geocub.greco-prog.fr> Sender: usenet@agate.berkeley.edu (USENET Administrator;;;;ZU44) Reply-To: jerry@violet.berkeley.edu ( Jerry Berkman ) Organization: University of California, Berkeley Lines: 44 In article <1349@geocub.greco-prog.fr> simonnet@goofi.UUCP (Simonnet Thierry) writes: > > 1 = 3 ...... > > > For some machines (HP1000 for example) 1 = 3 > > > program toto > > call add (1) > write (1,*) 'One = ?', 1 > end > > *--------------------------------------* > subroutine add (a) > > integer *2 a > > a = a + 2 > return > > end > >Result is : One = ? 3 !!!!! As Walt Brainard points out, changing the argument when the argument is a constant is non-standard, as is integer*2. Even on those systems which have the "integer*2" extension, it's doubtful that they all do the same thing for passing an integer constant like 1 to an integer*2 argument. Testing shows no consistent pattern: On Cray UNICOS (cft & cft77): output is "One = ?1" On IBM 3090: error: unit number out of range (using "1" as unit #!) On IBM 3090 writing to unit * instead of unit 1: output is: "One = ?131073" On sun 3/50: segmentation fault & output is 641 chars. of garbage On sun 3/50 without "*2": no seg. fault, output is 50 garbage chars. On VAX with BSD f77: BSS error, no output. (constants are stored in read only memory). On VAX with DEC Fortran: BSS error, no output. - Jerry Berkman, U.C.Berkeley, jerry@violet.berkeley.edu