Article View: comp.sys.atari.st
Article #27733Lattice 3.04 Bug - structure passing by value
From: John R. Bane
Date: Sat, 25 Jul 1987 07:34
Date: Sat, 25 Jul 1987 07:34
28 lines
1565 bytes
1565 bytes
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
Technical Details
Message-ID:
<390@parcvax.Xerox.COM>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!seismo!rutgers!ucla-cs!zen!ucbvax!hplabs!parcvax!baneShow 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!rutgers!ucla-cs!zen!ucbvax!hplabs!parcvax!bane From: bane@parcvax.Xerox.COM (John R. Bane) Newsgroups: comp.sys.atari.st Subject: Lattice 3.04 Bug - structure passing by value Message-ID: <390@parcvax.Xerox.COM> Date: Sat, 25-Jul-87 03:34:34 EDT Article-I.D.: parcvax.390 Posted: Sat Jul 25 03:34:34 1987 Date-Received: Sun, 26-Jul-87 00:42:16 EDT Reply-To: bane@parcvax.xerox.com.UUCP (John R. Bane) Organization: Xerox PARC Lines: 28 Keywords: Small structures lose