<HTML>
<HEAD>
<TITLE>C99 VLA bug?</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Thanks for all the hard work, I didn’t see this in bugzilla but maybe a known issue. The typedef seems to cause the issue, and unfortunately we use thru out our project. I’m using svn 92284<BR>
<BR>
The file:<BR>
#include <string.h><BR>
typedef unsigned char Byte;<BR>
void doit (char *data, int len) {<BR>
if (len) {<BR>
Byte buf[len];<BR>
memcpy(buf, data, len);<BR>
}<BR>
}<BR>
<BR>
<BR>
Compiled with “clang --analyze t.c”<BR>
<BR>
Gives me:<BR>
clang: ASTContext.cpp:2377: clang::QualType clang::ASTContext::getUnqualifiedArrayType(clang::QualType, clang::Qualifiers&): Assertion `T.isCanonical() && "Only operates on canonical types"' failed.<BR>
0 clang 0x000000000141b61f<BR>
1 clang 0x000000000141be21<BR>
2 libpthread.so.0 0x0000002a9567f160<BR>
3 libc.so.6 0x0000002a95d5f745 gsignal + 69<BR>
4 libc.so.6 0x0000002a95d60eb3 abort + 467<BR>
5 libc.so.6 0x0000002a95d58dc9<BR>
6 clang 0x000000000084cb06<BR>
7 clang 0x000000000084c9ea<BR>
8 clang 0x00000000006bc472<BR>
9 clang 0x000000000067d86f<BR>
10 clang 0x0000000000677124<BR>
11 clang 0x000000000067d99b<BR>
12 clang 0x0000000000677124<BR>
13 clang 0x000000000067608a<BR>
14 clang 0x0000000000676fd4<BR>
15 clang 0x000000000067dfe1<BR>
16 clang 0x000000000066c068<BR>
17 clang 0x000000000066c2d2<BR>
18 clang 0x00000000004d8b97<BR>
19 clang 0x00000000004d7530<BR>
20 clang 0x00000000004d7a15<BR>
21 clang 0x00000000006e0136<BR>
22 clang 0x00000000004345e0<BR>
23 clang 0x0000000000437661 main + 1585<BR>
24 libc.so.6 0x0000002a95d4d1d7 __libc_start_main + 215<BR>
25 clang 0x000000000043246a<BR>
Stack dump:<BR>
0. Program arguments: /usr/local/bin/clang -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -main-file-name t.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -warn-dead-stores -warn-security-syntactic -checker-cfref -analyzer-eagerly-assume -warn-objc-methodsigs -warn-objc-unused-ivars -analyzer-output plist -mrelocation-model static -mdisable-fp-elim -munwind-tables -target-cpu x86-64 -v -resource-dir /usr/local/lib/clang/1.1 -fmessage-length 138 -fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -o t.plist -x c t.c <BR>
1. <eof> parser at end of file<BR>
2. t.c:6:9: Error evaluating statement<BR>
3. t.c:6:9: Error evaluating statement<BR>
4. t.c:6:16: Error evaluating statement<BR>
5. t.c:6:16: Error evaluating statement<BR>
clang: error: analyzer command failed due to signal 6 (use -v to see invocation)</SPAN></FONT>
</BODY>
</HTML>