[rtems commit] libtests/malloc04: Prevent compiler optimizations

Sebastian Huber sebh at rtems.org
Fri May 10 10:05:35 UTC 2013


Module:    rtems
Branch:    master
Commit:    9deed9edbf2d75961155c77b4c0e1b545b7d236b
Changeset: http://git.rtems.org/rtems/commit/?id=9deed9edbf2d75961155c77b4c0e1b545b7d236b

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri May 10 11:58:39 2013 +0200

libtests/malloc04: Prevent compiler optimizations

---

 testsuites/libtests/malloc04/init.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/testsuites/libtests/malloc04/init.c b/testsuites/libtests/malloc04/init.c
index 89cbab3..c1fc236 100644
--- a/testsuites/libtests/malloc04/init.c
+++ b/testsuites/libtests/malloc04/init.c
@@ -41,7 +41,12 @@ void *rtems_heap_null_extend(
 #endif
 
 char Malloc_Heap[ 256 ] CPU_STRUCTURE_ALIGNMENT;
-int sbrk_count;
+
+/*
+ * Use volatile to prevent compiler optimizations due to the malloc() builtin.
+ */
+volatile int sbrk_count;
+
 Heap_Control TempHeap;
 
 size_t offset;




More information about the vc mailing list