🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #20429

LSC Bug (honest!!)

#20429
From: Alen Shapiro
Date: Fri, 16 Oct 1987 22:06
39 lines
1693 bytes
Can any of you guys out there in THINKland tell me why this program
terminates and do I get a free upgrade to 3.0 (symbolic debugger
and all) for finding a bug (grovel grovel)?

Seems that when I add zero to a register pointer it wants to add 8.
This is an isolation of a problem in a large suite of programs I am
writing. The #define of EXTRA to zero is a place keeper for future
improvements where extra space will be (but is not currently) needed.

Nevertheless I'm sure the compiler should not generate code that
adds a different definition of zero ((-: you know, the one more closely
related to 42 - the definition of zero that we have not yet come
across :-)).

--alen the Lisa slayer (it's a long story)

	...!seismo!esosun!cogen!alen

-----cut here----
#include <stdio.h>

/* on */
#define BUG	/* adding 0 to a register pointer adds 8 is this an
		 * overenthusiastic allignment preservation effect?
		 */

#define EXTRA 0

main() {
#ifdef BUG
	register char *c;
#else BUG
	char *c;
#endif BUG
	
	for(c=(char *)0 ; c < (char *)100 ; c += EXTRA)
		fprintf(stderr, "c = 0x%lx\n", c);
}
Technical Details
Message-ID: <372@cogen.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!seismo!esosun!cogen!alen
References: <1018@oakhill.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!mnetor!uunet!seismo!esosun!cogen!alen
From: alen@cogen.UUCP (Alen Shapiro)
Newsgroups: comp.sys.mac
Subject: LSC Bug (honest!!)
Message-ID: <372@cogen.UUCP>
Date: Fri, 16-Oct-87 18:06:00 EDT
Article-I.D.: cogen.372
Posted: Fri Oct 16 18:06:00 1987
Date-Received: Sun, 18-Oct-87 02:37:36 EDT
References: <1018@oakhill.UUCP>
Reply-To: alen@cogen.UUCP (Alen Shapiro)
Organization: Cogensys, LaJolla, Calf.
Lines: 39
Keywords: LSC register inc by zero
Summary: OK you asked for it