Commit c01c37a7 authored by Jon Olav Hauglid's avatar Jon Olav Hauglid

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.
parent 37de3c2c
...@@ -164,7 +164,14 @@ void do_tests() ...@@ -164,7 +164,14 @@ void do_tests()
test_concurrently("my_atomic_cas32", test_atomic_cas, THREADS, CYCLES); 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; a64=0;
my_atomic_add64(&a64, b); my_atomic_add64(&a64, b);
ok(a64==b, "add64"); ok(a64==b, "add64");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment