[LLVMdev] llc c backend can produce code that doesn't compile on gcc 4.x

Chris Lattner sabre at nondot.org
Mon Jan 15 08:48:11 PST 2007


On Mon, 15 Jan 2007, Nick Lewycky wrote:
> Eric van Riet Paap wrote:
>> *testme.cbe.c:106: error: array type has incomplete element type*
>
> The problem code boils down to:
>
>  /* Structure forward decls */
>  struct l_structtype_s;
>
>  /* Typedefs */
>  typedef struct l_structtype_s l_fixarray_array3[3];
>
> which is illegal C, but perfectly valid C++, and g++ accepts it.
>
> The structure contents are defined right afterwards, but I assume that
> the typedefs are used when emitting the structure contents? We may have
> to put fully defined structures first and typedefs second.

Looks like it.  It sounds like the CBE should build an ordering of types, 
based on their nesting properties, then emit them in nesting order. 
Because all recursive types have to go through a pointer in C, we should 
get a dag of types, which is easy to emit.

Anyone want to take a crack at it?

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list