<html><head><title></title></head><body><!-- rte-version 0.2 9947551637294008b77bce25eb683dac --><div class="rte-style-maintainer" style="font-family: Arial; white-space: pre-wrap; font-size: small; color: rgb(0, 0, 0);"data-color="global-default" bbg-color="default" data-bb-font-size="medium" bbg-font-size="medium" bbg-font-family="normal">According to my understanding, variable-length arrays were added in C99, yet clang warns on their use via the -Wvla warning:<div><br></div><div>void foo(void);</div><div>void foo(void)</div><div>{</div><div>    unsigned int size = 123;</div><div>    char foo[size];</div><div>    (void)foo;</div><div>}</div><div><br></div><div>$ clang -Weverything -c -std=c99 test.c</div><div><br></div><div>yields:</div><div><br></div><div>test.c:5:13: warning: variable length array used [-Wvla]</div><div>    char foo[size];</div><div><br></div><div>I found a test case for -Wvla on this (unofficial) mirror:</div><div><br></div><div><a spellcheck="false" href="https://github.com/llvm-mirror/clang/blob/master/test/Sema/warn-vla.c"bbg-destination="rte:bind" data-destination="rte:bind">https://github.com/llvm-mirror/clang/blob/master/test/Sema/warn-vla.c</a></div><div><br></div><div>This shows that the warning is expected even in C99 mode:</div><div><br></div><div>// RUN: %clang_cc1 -std=c99 -fsyntax-only -verify -Wvla %s</div><div>// RUN: %clang_cc1 -std=c89 -fsyntax-only -verify -Wvla %s</div><div><br></div><div>Is this correct? I notice -Wvla is only enabled by -Weverything, so is it experimental or not properly supported?</div><div><br></div><div>Thanks</div></div></body></html>