From owner-freebsd-bugs Mon Aug 16 10: 2:55 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id F0818154D7 for ; Mon, 16 Aug 1999 10:02:51 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id KAA84932; Mon, 16 Aug 1999 10:00:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Date: Mon, 16 Aug 1999 10:00:02 -0700 (PDT) Message-Id: <199908161700.KAA84932@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: "Steven G. Kargl" Subject: Re: bin/12431: f2c works incorrectly with arguments of subroutine with multiple entry points Reply-To: "Steven G. Kargl" Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR bin/12431; it has been noted by GNATS. From: "Steven G. Kargl" To: freebsd-gnats-submit@freebsd.org, dima@server.ru Cc: Subject: Re: bin/12431: f2c works incorrectly with arguments of subroutine with multiple entry points Date: Mon, 16 Aug 1999 09:53:18 -0700 The PR should be closed. Upon closer inspection it appears that the Dima's codes relies on undefine behavour. subroutine a(x,y,z) z=x+y return entry b(i) i=z return end program main call a(1.,2.,z) write(*,*) z call b(i) write(*,*) i stop end Z is a dummy argument to subroutine a(). Z goes out of scope when a() returns to main. When b() is called, z is an undefined variable. The correct fix is: subroutine a(x,y,z) real zz save zz data zz /0./ z=x+y zz=z return entry b(i) i=zz return end because the SAVE attribute can be used on local variables while it can not be used with dummy variables. -- Steve To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message