🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.f77
Article #373

Re: Subroutine bug with 4.2 BSD F77.

#373
From: sjc
Date: Mon, 16 Jun 1986 18:36
24 lines
1300 bytes
> 	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
Technical Details
Message-ID: <511@mips.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!decwrl!glacier!mips!sjc
References: <3174@sjuvax.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!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