🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #5184

Manx 5.0c Bug

#5184
From: Carry Varley
Date: Thu, 06 Sep 1990 13:11
44 lines
1340 bytes
/* A Serious Bug in
   Aztec C 5.0b Jun 18 1990   (C) 1990 by Manx Software Systems, Inc

 Compile options -s0o in this test case, 16 or 32 bit ints.

 In the actual code this was discovered in all optimization was on,
 and variable i was register, but kept on the stack due to other register
 usage (ie bug occurs with & without optimization). In the test case, result
 is good with optimize, bad without.

 Compile with -at option, and observe the difference.

*/

struct table {
	short Index;
	short Array[2];
} table;



main()
{
	register short i;
	short *ip;
	register struct table *sp = &table;

	table.Index = 0;
	table.Array[0] = 1;
	table.Array[1] = 2;

	i = *(ip = &sp->Array[sp->Index]);

	if(i == *ip)
		printf("Good\n");
	else
		printf("BAD Compiler\n");

}

/* C-Born Software Systems
   14 Lunan Avenue
   Drumcondra, 3215
   Australia. +61 (052) 786530 */
Technical Details
Message-ID: <764@sol.deakin.OZ.AU>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!munnari.oz.au!deakin.OZ.AU!carry
References: <^*}%^D+@masalla.fulcrum.bt.co.uk> <33535@cup.portal.com> <1162@mpirbn.mpifr-bonn.mpg.de>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!munnari.oz.au!deakin.OZ.AU!carry
From: carry@deakin.OZ.AU (Carry Varley)
Newsgroups: comp.sys.amiga.tech
Subject: Manx 5.0c Bug
Message-ID: <764@sol.deakin.OZ.AU>
Date: 6 Sep 90 13:11:27 GMT
References: <^*}%^D+@masalla.fulcrum.bt.co.uk> <33535@cup.portal.com> <1162@mpirbn.mpifr-bonn.mpg.de>
Sender: news@deakin.OZ.AU
Organization: Computing Services, Deakin Uni., Australia
Lines: 44