[cfe-dev] C99 VLA bug?

Andy Wick Andy.Wick at corp.aol.com
Wed Dec 30 03:44:29 PST 2009

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

The file:
#include <string.h>
typedef unsigned char Byte;
void doit (char *data, int len) {
    if (len) {
        Byte buf[len];
        memcpy(buf, data, len);

Compiled with ³clang --analyze t.c²

Gives me:
clang: ASTContext.cpp:2377: clang::QualType
clang::Qualifiers&): Assertion `T.isCanonical() && "Only operates on
canonical types"' failed.
0  clang           0x000000000141b61f
1  clang           0x000000000141be21
2  libpthread.so.0 0x0000002a9567f160
3  libc.so.6       0x0000002a95d5f745 gsignal + 69
4  libc.so.6       0x0000002a95d60eb3 abort + 467
5  libc.so.6       0x0000002a95d58dc9
6  clang           0x000000000084cb06
7  clang           0x000000000084c9ea
8  clang           0x00000000006bc472
9  clang           0x000000000067d86f
10 clang           0x0000000000677124
11 clang           0x000000000067d99b
12 clang           0x0000000000677124
13 clang           0x000000000067608a
14 clang           0x0000000000676fd4
15 clang           0x000000000067dfe1
16 clang           0x000000000066c068
17 clang           0x000000000066c2d2
18 clang           0x00000000004d8b97
19 clang           0x00000000004d7530
20 clang           0x00000000004d7a15
21 clang           0x00000000006e0136
22 clang           0x00000000004345e0
23 clang           0x0000000000437661 main + 1585
24 libc.so.6       0x0000002a95d4d1d7 __libc_start_main + 215
25 clang           0x000000000043246a
Stack dump:
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
1.    <eof> parser at end of file
2.    t.c:6:9: Error evaluating statement
3.    t.c:6:9: Error evaluating statement
4.    t.c:6:16: Error evaluating statement
5.    t.c:6:16: Error evaluating statement
clang: error: analyzer command failed due to signal 6 (use -v to see
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20091230/682210c7/attachment.html>

More information about the cfe-dev mailing list