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 a "array type has incomplete element type" error. this seems not valid C, precedently gcc accepted it as a (fragile) extension.
Created attachment 396 [details] .ll to reproduce the problem I'm attaching an .ll file that produces such rejected c: $ llvm-as -o ex.bc example.ll $ llc -march=c -o ex.c ex.bc $ gcc -c ex.c ex.c:85: error: array type has incomplete element type ex.c:98: warning: conflicting types for built-in function 'malloc' $ gcc --version i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5363)
Could someone please have a look at this? This bug prefends PyPy from using the later gcc versions.
Eric, I'd love to see this fixed, but don't have bandwidth to investigate it. I'd suggest making a call for help on the llvmdev list, you'll get more visibility there.
Created attachment 564 [details] test case for current llvm cvs head
Comment on attachment 564 [details] test case for current llvm cvs head llvm-as -f testme.ll;llc -march=c -f testme.bc;gcc -c testme.cbe.c
Potential patch here: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070115/042760.html
Rationale of patch is here: http://lists.cs.uiuc.edu/pipermail/llvmdev/2007-January/007804.html
Nice work, I applied Gordon's testcase here: Regression/CodeGen/CBackend/2007-01-15-NamedArrayType.ll and here's a slightly adapted version of his patch: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070115/042762.html Thanks Gordon! -Chris
great stuff! thank you Gordon and Chris!