[GCC-XML] Bug with empty structure
Brad King
brad.king at kitware.com
Fri Jun 24 15:24:45 EDT 2005
Thomas Heller wrote:
> Brad King <brad.king at kitware.com> writes:
>
>
>>Thomas Heller wrote:
>>
>>>On this structure (I know it's silly, but it seems to appear in real
>>>world header files)
>>>typedef struct {
>>>// OBSOLETE
>>>} Y;
>>>gccxml generates this:
>>><?xml version="1.0"?>
>>><GCC_XML cvs_revision="1.96">
>>> <Namespace id="_1" name="::" members="_3 " mangled="_Z2::"/>
>>> <Namespace id="_2" name="std" context="_1" members="" mangled="_Z3std"/>
>>> <Struct id="_3" name="Y" context="_1" mangled="1Y" location="f0:3"
>>> file="f0" line="3" size="8" align="8" members="_4 _5 " bases=""/>
>>> ^^^^^^^^
>>>size="8" is a bug, isn't it?
>>
>>That's the size that GCC's parser is giving to the xml dump code. C
>>and C++ structures cannot be zero size because each object is supposed
>>to have a unique address. It is up to the compiler to choose a size
>>for empty objects. For some reason GCC is choosing size 8.
>
>
> Is that really true? gcc on my suse system, when compiling a program
> which prints sizeof(Y) with the above definition and running it says
> sizeof(Y) = 0, which is what I would expect.
Is that compiling a C program or a C++ program?
-Brad
More information about the gccxml
mailing list