[comp.sys.atari.st] Lattice 3.04 Bug - structure passing by value

bane@parcvax.Xerox.COM (John R. Bane) (07/25/87)

The following program should print "1234"; when compiled by Lattice 3.04,
it prints "3434".  The problem only occurs with structures smaller than
four bytes; what happens is that the code in the caller and the code in
the callee disagree on the alignment of the structure within the 4-byte
area the caller copies the structure into. It took me two evenings to
track this one down; thanks, Lattice!

/* this is a test of structure passing */
struct bogus {unsigned char a,b;};

main () {
	struct bogus b1,b2;
	b1.a = 1; b1.b = 2; b2.a = 3; b2.b = 4;
	subr(b1, b2);
        }

subr(b1,b2) struct bogus b1,b2; {
	printf("%d%d%d%d\n", b1.a, b1.b, b2.a, b2.b);
}

Despite this lossage, the 3.04 upgrade is well worth getting, for the
debugger (semi-symbolic), window-and-mouse editor, Kuma resource editor,
and make program.  I have no opinion on Lattice vs the others if you
aren't just getting the upgrade.
-- 
	Rene P.S. Bane
	bane.pa@xerox.ARPA
	...!parcvax!bane.UUCP