add volatile for igzip/checksum32_funs_test

When using RISC-V GCC 14, `gcc -O0` passes the test, but `gcc -O2` fails.

The log shows that it enters the branch `if (c_dut != c_ref) {`

even though `c_dut` and `c_ref` have the same value.

Adding `volatile` allows the test to pass.

Signed-off-by: sunyuechi <sunyuechi@iscas.ac.cn>
This commit is contained in:
sunyuechi
2025-02-27 12:19:18 +08:00
committed by Pablo de Lara
parent e0687d4964
commit 027be4beb9

View File

@@ -126,7 +126,7 @@ main(int argc, char *argv[])
int
zeros_test(func_case_t *test_func)
{
uint32_t c_dut, c_ref;
volatile uint32_t c_dut, c_ref;
int fail = 0;
unsigned char *buf = NULL;
@@ -153,7 +153,7 @@ zeros_test(func_case_t *test_func)
int
simple_pattern_test(func_case_t *test_func)
{
uint32_t c_dut, c_ref;
volatile uint32_t c_dut, c_ref;
int fail = 0;
unsigned char *buf = NULL;
@@ -176,7 +176,7 @@ simple_pattern_test(func_case_t *test_func)
int
seeds_sizes_test(func_case_t *test_func)
{
uint32_t c_dut, c_ref;
volatile uint32_t c_dut, c_ref;
int fail = 0;
int i;
uint32_t r, s;
@@ -251,7 +251,7 @@ seeds_sizes_test(func_case_t *test_func)
int
eob_test(func_case_t *test_func)
{
uint32_t c_dut, c_ref;
volatile uint32_t c_dut, c_ref;
int fail = 0;
int i;
unsigned char *buf = NULL;
@@ -277,7 +277,7 @@ eob_test(func_case_t *test_func)
int
update_test(func_case_t *test_func)
{
uint32_t c_dut, c_ref;
volatile uint32_t c_dut, c_ref;
int fail = 0;
int i;
uint32_t r;
@@ -310,7 +310,7 @@ update_test(func_case_t *test_func)
int
update_over_mod_test(func_case_t *test_func)
{
uint32_t c_dut, c_ref;
volatile uint32_t c_dut, c_ref;
int fail = 0;
int i;
unsigned char *buf = NULL;