🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.micro.mac
Article #6158

Re: Megamax bug?

#6158
From: pedz
Date: Fri, 20 Jun 1986 19:59
40 lines
1401 bytes
main()
{
	int i, j;

	for (i = 10; i--;);
	j = i;
}

CODE SEG "main"
main:/* global */
	LINK	A6,L$0
	MOVE	#10,-2(A6)
L3:
L4:
L2:
	MOVE	-2(A6),D0		<< Get i
	SUBQ	#1,-2(A6)		<< do the decrement
	TST	D0			<< do the test
	BNE.S	L3
L5:
	MOVE	-2(A6),-4(A6)
L1:
	UNLK	A6
	RTS
L$0:	.EQU	#-4
_initargcv:/* global */
	RTS

Matt gets the cookie this time.  The original bug notice was correct
in his statements about how C should behave.  The above code segment
shows that in the current release, this is not a bug.  I am reasonable
sure that it has never been a bug but perhaps someone has a really old
version.  I would suggest that the original poster disassemble his
output and look at the code.  I am sure it will be different from
above but the important thing is that the decrement is done before the
test.

Perry Smith
pedz@megamax
Technical Details
Message-ID: <3700001@megamax>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbosgd!ihnp4!inuxc!pur-ee!uiucdcs!convex!megamax!pedz
References: <1023@k.cs.cmu.edu>

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!cbosgd!ihnp4!inuxc!pur-ee!uiucdcs!convex!megamax!pedz
From: pedz@megamax
Newsgroups: net.micro.mac
Subject: Re: Megamax bug?
Message-ID: <3700001@megamax>
Date: Fri, 20-Jun-86 15:59:00 EDT
Article-I.D.: megamax.3700001
Posted: Fri Jun 20 15:59:00 1986
Date-Received: Mon, 23-Jun-86 01:16:38 EDT
References: <1023@k.cs.cmu.edu>
Lines: 40
Nf-ID: #R:k.cs.cmu.edu:1023:megamax:3700001:000:829
Nf-From: megamax!pedz    Jun 20 14:59:00 1986