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?a=commitdiff_plain;h=2238c96ecda3b083eafbfcc3c2d8ebf2ade79d50;p=pintos-anon 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 */