Subject: Re: standards/5959: c++ language specification error or compiler error??
To: Andrew Brown <twofsonet@graffiti.com>
From: Jeff Mitchell <skeezix@skeleton.org>
List: netbsd-bugs
Date: 08/13/1998 11:45:02
On Wed, 12 Aug 1998, Andrew Brown wrote:

> so this is yet another problem with "not upgrading frequently"?  is
> there any comment on this anywhere in the c++ arm (that anyone can
> find)?

	Since we're complaining about gcc bugs in the netbsd list... :)

	I've noticed in some versions of gcc (but not all, and I've not
tried most recent versions), that __attribute__ ((packed)) doesn't work on
structures.

	ie:

	struct foo {
		int x;
		char waka [ 10 ];
	} __attribute__ ((packed));

	*should* be the same as:

	struct foo {
		int x __attribute__ ((packed));
		char waka [ 10 ] __attribute__ ((packed));
	}

	as per the gcc documentation.

	I've found numerous versions where the sizeof() will return
differening values for the above, and cause all sorts of problems. (more
specifically, a silly lad I know is using a packed struct to read in FLiC
headers and GIF headers and the like, instead of reading element by
element as god intended. It hardly ever works when porting).

	Am I missing something, or is this a legit bug? Should I be
pairing the ((packed)) with another (say, allignment) to make gcc more
consistent?

	My current fix is a perlfrob which looks for the packed attribute
following a struct, and reapplies it to each member item. Gah.

		Jeff

--
"It's murder out there. You can't even travel around in your own micro
circuits without permission from 'Master Control Program'. I mean,
sending *ME* down here to play games.... Who does he calculate he is?"
-- Peter Jurasik as Crom, _Tron_