Structure initialization problem

Michael Meissner meissner@cygnus.com
Mon Dec 21 06:10:00 GMT 1998


It looks like egcs 1.1.1, and the current egcs have a bug in structure
initializations where there is a :0 field.  For the following code:

	struct foo {
	  signed char a;
	  int : 0;
	  signed char b;
	  signed char c;
	} bar = { -1, -1, 1 };

Gcc 2.7.2.3 and egcs 1.0.3 both compile this on the x86 as:

	bar:
		.byte -1
		.zero 3
		.byte -1
		.byte 1

However, more recent versions of the compiler compile this as:

	bar:
		.byte -1
		.zero 4
		.byte 1

(ie, the first initialization after the :0 is ignored).

I'll be looking into it further, but I thought people would appreciate
knowing about it.

-- 
Michael Meissner, Cygnus Solutions (Massachusetts office)
4th floor, 955 Massachusetts Avenue, Cambridge, MA 02139, USA
meissner@cygnus.com,	617-354-5416 (office),	617-354-7161 (fax)



More information about the Gcc-bugs mailing list