Clang bug with C99 array as parameter

Dear all,

I do not know if this bug is already known:
With clang trunk (r110038) the following call fails:
clang test.c

with test.c:
void function(short width, int data[width]) {}
void test() {
     function(1, 0);

I get an assertion in CodeGen:
/clang_trunk/cmake/bin/clang test.c
clang: /clang_trunk/llvm/tools/clang/lib/CodeGen/CGExpr.cpp:1167:
clang::DeclRefExpr*): Assertion `V && "DeclRefExpr not entered in
LocalDeclMap?"' failed.
Stack dump:
0. Program arguments: /clang_trunk/cmake/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -S -disable-free -main-file-name test.c
-mrelocation-model static -mdisable-fp-elim -mconstructor-aliases
-munwind-tables -target-cpu x86-64 -resource-dir
/clang_trunk/cmake/lib/clang/2.8 -ferror-limit 19 -fmessage-length 80
-fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/cc-CFGwvn.s -x c test.c
1. <eof> parser at end of file
2. test.c:2:6: LLVM IR generation of declaration 'test'
3. test.c:2:6: Generating code for declaration 'test'
4. test.c:2:13: LLVM IR generation of compound statement ('{}')
clang: error: clang frontend command failed due to signal 6 (use -v to
see invocation)

Also let mt thank you for your great compiler!

Very interesting! I looked into it, and there isn't a quick fix. Please file a bug.


John McCall wrote: