From: Bruno Haible Date: Wed, 10 Jan 2024 13:22:44 +0000 (+0100) Subject: jit/cache tests: Avoid compiler warnings on OpenBSD. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=2c235122e29d7fc62e413a6632d2a33e10229568;p=gnulib.git jit/cache tests: Avoid compiler warnings on OpenBSD. * tests/jit/test-cache.c (main): New variables size_of_return1, size_of_return2. --- diff --git a/ChangeLog b/ChangeLog index e31eefe3cd..aa6177fbd3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2024-01-10 Bruno Haible + + jit/cache tests: Avoid compiler warnings on OpenBSD. + * tests/jit/test-cache.c (main): New variables size_of_return1, + size_of_return2. + 2024-01-09 Bruno Haible jit/cache: Fix for ia64 CPUs. diff --git a/tests/jit/test-cache.c b/tests/jit/test-cache.c index 0a52c9f3bd..cabbc0ddfd 100644 --- a/tests/jit/test-cache.c +++ b/tests/jit/test-cache.c @@ -210,6 +210,8 @@ main () { void const *code_of_return1; void const *code_of_return2; + size_t size_of_return1; + size_t size_of_return2; #if defined __OpenBSD__ || defined _RET_PROTECTOR /* OpenBSD maps code with PROT_EXEC (as opposed to PROT_READ | PROT_EXEC). We need to use predetermined code for 'return1' and 'return2'. */ @@ -220,12 +222,15 @@ main () we need to use predetermined code for 'return1' and 'return2'. */ code_of_return1 = return1_code; code_of_return2 = return2_code; + size_of_return1 = sizeof (return1_code); + size_of_return2 = sizeof (return2_code); #else code_of_return1 = CODE (return1); code_of_return2 = CODE (return2); -#endif /* We assume that the code is not longer than 64 bytes. */ - size_t code_size_bound = 64; + size_of_return1 = 64; + size_of_return2 = 64; +#endif int const pagesize = getpagesize (); int const mapping_size = 1 * pagesize; @@ -303,11 +308,11 @@ main () int (*f) (void) = COPY_FUNCPTR (return1); CODE (f) = start; - memcpy (start_rw, code_of_return1, code_size_bound); + memcpy (start_rw, code_of_return1, size_of_return1); clear_cache (start, end); ASSERT (f () == 1); - memcpy (start_rw, code_of_return2, code_size_bound); + memcpy (start_rw, code_of_return2, size_of_return2); clear_cache (start, end); ASSERT (f () == 2);