[comp.sys.ibm.pc] new

ddl@husc6.harvard.edu (Dan Lanciani) (12/25/88)

	There is a bug in MSC 5.1 which is demonstrated by the following
program (compile small model, no special options):

unsigned foo;

func(x)
register unsigned x;
{
	foo = ((long)x) << 8;
}

main()
{
	func(1);
	printf("foo = %u\n", foo);
}

	The value assigned to foo is taked from register DH which is
set nowhere in the code.  Changing "register unsigned x;" to simply
"unsigned x;" fixes the problem, as does deleting the cast to long.
For that matter, changing the type of "x" to "int" or the type of
the cast to "unsigned long" also produces correct code, but please
don't start a discussion about not casting unsigned's to long's :)
	Examination of the code (and a few other examples) suggests
that the compiler might think it can get at individual bytes of
SI and DI in DH and BH.  This bug did not exist in 4.0; I don't
have the energy to try loading 5.0...

				Dan Lanciani
				ddl@harvard.*