From: Ben Pfaff Date: Fri, 10 Nov 2006 15:51:03 +0000 (+0000) Subject: Add "memory" as clobber to the asm used by barrier(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pintos-anon;a=commitdiff_plain;h=6d19139b337fcb7c9b31e5b6724e6ae19499e4c5 Add "memory" as clobber to the asm used by barrier(). Otherwise at least some versions of GCC assume that no changes to memory can take place. --- diff --git a/src/threads/synch.h b/src/threads/synch.h index 6b8f550..9e464e3 100644 --- a/src/threads/synch.h +++ b/src/threads/synch.h @@ -45,6 +45,6 @@ void cond_broadcast (struct condition *, struct lock *); The compiler will not reorder operations across an optimization barrier. */ -#define barrier() asm volatile ("") +#define barrier() asm volatile ("" : : : "memory") #endif /* threads/synch.h */