This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/12999] New: Internal compiler error for syntax error with __attribute__ ((packed))


Save the following code in a module name StructSize.c:
#include <stdio.h>

typedef unsigned char ILubyte;
typedef unsigned short ILushort;
typedef short ILshort;

int main()
{
#pragma pack(1)
	typedef struct TARGAHEAD
	{
		ILubyte		IDLen;
		ILubyte		ColMapPresent;
		ILubyte		ImageType;
		ILshort		FirstEntry;
		ILshort		ColMapLen;
		ILubyte		ColMapEntSize;
	
		ILshort		OriginX;
		ILshort		OriginY;
		ILushort	Width;
		ILushort	Height;
		ILubyte		Bpp;
		ILubyte		ImageDesc;
	} TARGAHEAD; __attribute__ ((packed)) TARGAHEAD;
#pragma pack()
	
	printf("The structure size is %d bytes.\n", sizeof(TARGAHEAD));
	return 0;
}

Note the code has a synatax error after the typedef statement for TARGAHEAD.

Attempt to build the code using the command:  g++ -o StructSize StructSize.c

On version 3.3.2 of the GNU compiler the following output occurs:

StructSize.c: In function `int main()':
StructSize.c:25: internal compiler error: Bus error
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

Found a Macintosh G4 system running Mac OS X 10.2.8.

-- 
           Summary: Internal compiler error for syntax error with
                    __attribute__ ((packed))
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tron dot thomas at verizon dot net
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12999


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]