[okl4-developer] [PATCH] compiler removes updates of shared variables in l4test
Tomas Hruby
thruby at cs.otago.ac.nz
Mon Sep 29 16:27:05 EST 2008
When compiling l4test with gcc version 4.2.4 for sparc v9 (no
optimisations) the compiler removes updates of some variables shared
between threads which breaks some tests. Marking the variables as
volatile fixes the problem.
diff -ru orig/l4test/src/mutex.c fix/l4test/src/mutex.c
--- orig/l4test/src/mutex.c 2008-09-29 10:12:06.000000000 +1000
+++ fix/l4test/src/mutex.c 2008-09-29 16:19:10.000000000 +1000
@@ -857,7 +857,7 @@
/* L4_Mutex Unwinding ------------------------------------------*/
-static int mutex0600_progress;
+static volatile int mutex0600_progress;
static void mutex0600_child_thread(void)
{
L4_Word_t res;
diff -ru orig/l4test/src/scheduleinheritance.c fix/l4test/src/scheduleinheritance.c
--- orig/l4test/src/scheduleinheritance.c 2008-09-29 10:12:06.000000000 +1000
+++ fix/l4test/src/scheduleinheritance.c 2008-09-29 16:19:17.000000000 +1000
@@ -1436,7 +1436,7 @@
L4_WaitForever();
}
-static L4_Word_t flag[3];
+static volatile L4_Word_t flag[3];
static void
mutex0300_locking_thread(void)
More information about the Developer
mailing list