summaryrefslogtreecommitdiff
path: root/unittest
diff options
context:
space:
mode:
authorJon Olav Hauglid <jon.hauglid@oracle.com>2011-10-03 09:31:55 +0200
committerJon Olav Hauglid <jon.hauglid@oracle.com>2011-10-03 09:31:55 +0200
commitc01c37a7ef37ac9e407005e48d173ae61d9b2c72 (patch)
tree14e9dc52a82848497fdce1275d334aa05d3e5884 /unittest
parent37de3c2c0bcb642bb71e7f842c26208b5bfd7dd9 (diff)
downloadmariadb-git-c01c37a7ef37ac9e407005e48d173ae61d9b2c72.tar.gz
Bug#13030056 62533: UNITTEST/MYSYS/MY_ATOMIC-T.C DOES NOT
COMPILE ON MACOSX LION The problem was that on optimized builds, the wrong code was generated for my_atomic_add64 if a variable argument was optimized away as a constant. This patch fixes the problem by making the variable volatile. Another workaround is to specify architecture explicitly using e.g. CFLAGS/CXXFLAGS= "-m64". No test case added.
Diffstat (limited to 'unittest')
-rw-r--r--unittest/mysys/my_atomic-t.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/unittest/mysys/my_atomic-t.c b/unittest/mysys/my_atomic-t.c
index 89588a05405..ae9bb6903f5 100644
--- a/unittest/mysys/my_atomic-t.c
+++ b/unittest/mysys/my_atomic-t.c
@@ -164,7 +164,14 @@ void do_tests()
test_concurrently("my_atomic_cas32", test_atomic_cas, THREADS, CYCLES);
{
- int64 b=0x1000200030004000LL;
+ /*
+ If b is not volatile, the wrong assembly code is generated on OSX Lion
+ as the variable is optimized away as a constant.
+ See Bug#62533 / Bug#13030056.
+ Another workaround is to specify architecture explicitly using e.g.
+ CFLAGS/CXXFLAGS= "-m64".
+ */
+ volatile int64 b=0x1000200030004000LL;
a64=0;
my_atomic_add64(&a64, b);
ok(a64==b, "add64");