[PATCH] loader: Use a volatile pointer in wld_memset().

Charles Davis cdavis5x at gmail.com
Thu Dec 20 14:50:17 CST 2012


This prevents Clang from optimizing the loop into a memset(3) call.
---
 loader/preloader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/loader/preloader.c b/loader/preloader.c
index a94c52c..b0d9197 100644
--- a/loader/preloader.c
+++ b/loader/preloader.c
@@ -451,7 +451,7 @@ static int wld_strncmp( const char *str1, const char *str2, size_t len )
 
 static inline void *wld_memset( void *dest, int val, size_t len )
 {
-    char *dst = dest;
+    volatile char *dst = dest;
     while (len--) *dst++ = val;
     return dest;
 }
-- 
1.7.12.4




More information about the wine-patches mailing list