[GCC-XML] Bug with empty structure

Brad King brad.king at kitware.com
Thu Jun 23 16:53:50 EDT 2005


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.

-Brad



More information about the gccxml mailing list