From f7b01a39b55c7242dcf2af73006310225663fcc8 Mon Sep 17 00:00:00 2001
From: Vasil Dimov <vasil.dimov@oracle.com>
Date: Fri, 1 Oct 2010 14:51:00 +0300
Subject: [PATCH] Fix a potential bug when using __sync_lock_test_and_set()

This is a manual merge from mysql-5.1-innodb of:

  revision-id: vasil.dimov@oracle.com-20100930102618-s9f9ytbytr3eqw9h
  committer: Vasil Dimov <vasil.dimov@oracle.com>
  timestamp: Thu 2010-09-30 13:26:18 +0300
  message:
    Fix a potential bug when using __sync_lock_test_and_set()

    TYPE __sync_lock_test_and_set (TYPE *ptr, TYPE value, ...)

    it is not documented what happens if the two arguments are of different
    type like it was before: the first one was lock_word_t (byte) and the
    second one was 1 or 0 (int).

    Approved by:	Marko (via IRC)
---
 storage/innobase/include/os0sync.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/storage/innobase/include/os0sync.h b/storage/innobase/include/os0sync.h
index 0b600c80ce3..ec5ccee3e27 100644
--- a/storage/innobase/include/os0sync.h
+++ b/storage/innobase/include/os0sync.h
@@ -289,7 +289,7 @@ amount of increment. */
 Returns the old value of *ptr, atomically sets *ptr to new_val */
 
 # define os_atomic_test_and_set_byte(ptr, new_val) \
-	__sync_lock_test_and_set(ptr, new_val)
+	__sync_lock_test_and_set(ptr, (byte) new_val)
 
 #elif defined(HAVE_IB_SOLARIS_ATOMICS)