Ian Mordey <ian.mor...@wandisco.com> writes:

> Thanks very much for your assistance. If you require any further info/tests
> running please let me know and I'll sort it out.

configure attempts to detect the builtin atomics by building and running
the following code:

int main()
{
      unsigned long long val = 1010, tmp, *mem = &val;

      if (__sync_fetch_and_add(&val, 1010) != 1010 || val != 2020)
          return 1;

      tmp = val;

      if (__sync_fetch_and_sub(mem, 1010) != tmp || val != 1010)
          return 1;

      if (__sync_sub_and_fetch(&val, 1010) != 0 || val != 0)
          return 1;

      tmp = 3030;

      if (__sync_val_compare_and_swap(mem, 0, tmp) != 0 || val != tmp)
          return 1;

      if (__sync_lock_test_and_set(&val, 4040) != 3030)
          return 1;

      mem = &tmp;

      if (__sync_val_compare_and_swap(&mem, &tmp, &val) != &tmp)
          return 1;

      __sync_synchronize();

      if (mem != &val)
          return 1;

      return 0;
} 

So something like:

   suncc -o conftest conftest.c
   ./conftest
   echo $?

with whatever other optimisation flags you pass to cc.  Does that
program compile and run?  I'd expect it to fail.  Do you see the failure
in config.log.

-- 
Philip

Reply via email to