1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
From: Gert Wollny <gewo@debian.org>
Date: Thu, 1 Sep 2022 21:00:02 -0500
Subject: Initialize arrays in tests
in C it can not be assumed that the arrays are initialaized to a sane
value when they are declared on the stack, hence initialiaze the
dimension to zero (this also makes the compiler fill the whole struct
with zeros.
---
testdir/multidim_test.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/testdir/multidim_test.c b/testdir/multidim_test.c
index ea088c0..769b0dc 100644
--- a/testdir/multidim_test.c
+++ b/testdir/multidim_test.c
@@ -5,7 +5,7 @@
static int
test1(void)
{
- VIO_multidim_array array;
+ VIO_multidim_array array = {0};
int sizes[TEST1_N_DIMENSIONS] = { 1, 1, 1 };
int read_sizes[VIO_MAX_DIMENSIONS] = { 5, 5, 5, 5, 5 };
int i;
@@ -90,7 +90,7 @@ test1(void)
static int
test2(void)
{
- VIO_multidim_array array;
+ VIO_multidim_array array = {0};
int sizes[TEST2_N_DIMENSIONS] = { 31, 61, 53, 41, 3 };
int read_sizes[VIO_MAX_DIMENSIONS] = { 5, 5, 5, 5, 5 };
int value;
@@ -186,7 +186,7 @@ test2(void)
static int
test3(VIO_Data_types data_type, int n_dimensions, int sizes[])
{
- VIO_multidim_array array;
+ VIO_multidim_array array = {0};
int index[VIO_MAX_DIMENSIONS];
int i;
int n;
|