[okl4-developer] [PATCH] compiler removes updates of shared variables in l4test

Geoffrey Lee glee at ok-labs.com
Mon Sep 29 19:08:56 EST 2008


On Mon, Sep 29, 2008 at 04:27:05PM +1000, Tomas Hruby wrote:
> 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.

Hi Tomas - thanks for the bug report and patch, I've filed this into 
our issue tracking system.

	-gl

> 
> 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)
> 
> _______________________________________________
> Developer mailing list
> Developer at okl4.org
> https://lists.okl4.org/mailman/listinfo/developer
> 

-- 




More information about the Developer mailing list