From a0eb2a44db499422b0394f4b0bf7ed7a6ed37ecf Mon Sep 17 00:00:00 2001 From: Marc Kirchner Date: Fri, 5 Jan 2024 13:55:14 +0400 Subject: [PATCH] add alignment guarantees to static char arrays --- test/test_hamt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/test_hamt.c b/test/test_hamt.c index 2537ab6..af9537f 100644 --- a/test/test_hamt.c +++ b/test/test_hamt.c @@ -800,10 +800,11 @@ MU_TEST_CASE(test_setget_zero) */ /* add a single key */ - char key[] = "the_key"; - char value[] = "the_value"; + char key[] __attribute__ ((aligned (8))) = "the_key"; + char value[] __attribute__ ((aligned (8))) = "the_value"; const char *val = hamt_set(t, key, value); MU_ASSERT(hamt_size(t) == 1, "wrong size after set"); + MU_ASSERT(strcmp(val, value) == 0, "values are not the same"); MU_ASSERT(val == value, "value should point to the original value"); /* make sure we can find it */ val = hamt_get(t, key);