Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!decwrl!glacier!mips!sjc From: sjc@mips.UUCP Newsgroups: net.lang.f77,net.bugs.4bsd Subject: Re: Subroutine bug with 4.2 BSD F77. Message-ID: <511@mips.UUCP> Date: Mon, 16-Jun-86 14:36:07 EDT Article-I.D.: mips.511 Posted: Mon Jun 16 14:36:07 1986 Date-Received: Wed, 18-Jun-86 04:15:12 EDT References: <3174@sjuvax.UUCP> Distribution: net Organization: MIPS Computer Systems, Sunnyvale, CA Lines: 24 Xref: watmath net.lang.f77:548 net.bugs.4bsd:2175 > User defined functions always return a value of 0 (including > logical functions). > > integer i > i = 1 > print *, bug(i) > stop > end > > integer function bug(i) > integer i > bug = 2 > return > end Because "bug" begins with the letter "b", the main program thinks that its type is "real", despite the later definition of it as "integer". Change "integer i" to "integer i, bug" in the main program and your program will work. (This is ANSI X3.9-1978 Fortran, not a bug: when the compiler processes program unit "x", it is not allowed to use any knowledge it may have about program unit "y", even if "x" and "y" appear in the same file--even if "y" precedes "x" in the file.) -- ...decwrl!mips!sjc Steve Correll