[clang] [clang] Fix crashes when passing VLA to va_arg (PR #119563)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 13 14:36:53 PST 2024
================
@@ -20,4 +20,7 @@ void vla(int n, ...)
__builtin_va_list ap;
void *p;
p = __builtin_va_arg(ap, typeof (int (*)[++n])); // CHECK: add nsw i32 {{.*}}, 1
+ // Don't crash on some undefined behaviors.
+ p = __builtin_va_arg(ap, typeof (int [++n])); // expected-warning{{second argument to 'va_arg' is of variable length array type 'typeof(int[++n])'}}
----------------
efriedma-quic wrote:
Maybe put the warning checks into some test in clang/test/Sema.
https://github.com/llvm/llvm-project/pull/119563
More information about the cfe-commits
mailing list