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

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
}

It seems very similar to 737 – [llvmg++4] Code quality issue with gimplified array ctor .
You might want to check if it's the same problem. If not, then please
create a new bug report.

-bw

Ignore what I just said. I was looking at the wrong problem...Sorr...

-bw

The C backend can currently (recent head) produce code with such patterns:
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?

This looks like a bug, please file it (including the .ll file) in bugzilla.

Thanks!

-Chris

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
}
_______________________________________________
LLVM Developers mailing list
LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-Chris

Chris Lattner wrote: