[clang] 56079e1 - [Analyzer][VLASizeChecker] Try to fix vla.c test problems.
Balázs Kéri via cfe-commits
cfe-commits at lists.llvm.org
Tue May 19 03:11:37 PDT 2020
Author: Balázs Kéri
Date: 2020-05-19T12:12:28+02:00
New Revision: 56079e1de1129837aa7569d8b3bb5e50afc0f1ea
URL: https://github.com/llvm/llvm-project/commit/56079e1de1129837aa7569d8b3bb5e50afc0f1ea
DIFF: https://github.com/llvm/llvm-project/commit/56079e1de1129837aa7569d8b3bb5e50afc0f1ea.diff
LOG: [Analyzer][VLASizeChecker] Try to fix vla.c test problems.
Added:
Modified:
clang/test/Analysis/vla.c
Removed:
################################################################################
diff --git a/clang/test/Analysis/vla.c b/clang/test/Analysis/vla.c
index 062bb0828e23..a269ef334c32 100644
--- a/clang/test/Analysis/vla.c
+++ b/clang/test/Analysis/vla.c
@@ -18,11 +18,11 @@ void check_uninit_sized_VLA() {
}
// Negative VLAs.
-static void vla_allocate_signed(int x) {
+static void vla_allocate_signed(short x) {
int vla[x]; // expected-warning{{Declared variable-length array (VLA) has negative size}}
}
-static void vla_allocate_unsigned(unsigned int x) {
+static void vla_allocate_unsigned(unsigned short x) {
int vla[x]; // no-warning
}
@@ -35,12 +35,12 @@ void check_negative_sized_VLA_2() {
}
void check_negative_sized_VLA_3() {
- int x = -1;
+ short x = -1;
int vla[x]; // expected-warning{{Declared variable-length array (VLA) has negative size}}
}
void check_negative_sized_VLA_4() {
- unsigned int x = -1;
+ unsigned short x = -1;
int vla[x]; // no-warning
}
@@ -79,12 +79,12 @@ void check_negative_sized_VLA_10(int x) {
check_negative_sized_VLA_10_sub(x);
}
-static void check_negative_sized_VLA_11_sub(int x)
+static void check_negative_sized_VLA_11_sub(short x)
{
int vla[x]; // no-warning
}
-void check_negative_sized_VLA_11(int x) {
+void check_negative_sized_VLA_11(short x) {
if (x > 0)
check_negative_sized_VLA_11_sub(x);
}
More information about the cfe-commits
mailing list