Protect against compiler optimizations

GCC 5.4 optimized the write after poisoning (the surprising thing is that
11.4 doesn't).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
diff --git a/programs/test/metatest.c b/programs/test/metatest.c
index 0910798..1724aed 100644
--- a/programs/test/metatest.c
+++ b/programs/test/metatest.c
@@ -66,6 +66,15 @@
     memset((void *) p, false_but_the_compiler_does_not_know, n);
 }
 
+/* Simulate an access to the given object, to avoid compiler optimizations
+ * in code that prepares or consumes the object. */
+static void do_nothing_with_object(void *p)
+{
+    (void) p;
+}
+void(*volatile do_nothing_with_object_but_the_compiler_does_not_know)(void *) =
+    do_nothing_with_object;
+
 
 /****************************************************************/
 /* Test framework features */
@@ -202,7 +211,9 @@
 
     if (direction == 'w') {
         aligned.buf[start + offset] = 'b';
+        do_nothing_with_object_but_the_compiler_does_not_know(aligned.buf);
     } else {
+        do_nothing_with_object_but_the_compiler_does_not_know(aligned.buf);
         mbedtls_printf("%u\n", (unsigned) aligned.buf[start + offset]);
     }
 }