[LLVMdev] bug? c backend produces code rejected by gcc4.0.1: array type has incomplete element type

Samuele Pedroni pedronis at strakt.com
Wed Sep 20 08:39:08 PDT 2006


The C backend can currently (recent head) produce code with such patterns:

/* Global Declarations */
/* Structure forward decls */
struct l_structtype_s;

/* Typedefs */
typedef struct l_structtype_s l_fixarray_array3[3]; /* problematic 
declaration */
typedef struct l_structtype_s l_structtype_s;

/* Structure contents */
struct l_structtype_s {
  int field0;
};

gcc 4.0.1 will reject this with

example.c:7: error: array type has incomplete element type

this kind of code was accepted by previous versions of gcc as a fragile 
extension,
but is no longer at least in 4.0.1 .

is this known? should I file a bug?

regards.

PS: This code produces such a pattern through llvm-as, and llc -march=c:

target endian = little
target pointersize = 32
target triple = "i686-apple-darwin8.7.1"

%fixarray_array3 = type [3 x %structtype_s]
%structtype_s = type { int }

int %witness(%fixarray_array3* %p) {
     %q = getelementptr %fixarray_array3* %p, uint 0, uint 0, uint 0
     %v = load int* %q
     ret int %v
}



More information about the llvm-dev mailing list