This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/21097] New: __sync_bool_compare_and_swap doesn't work with -m32


[hjl@gnu-9 gcc]$ cat /tmp/x.c
#include <stdio.h>

#ifdef OLD
extern int __sync_bool_compare_and_swap_di (long *, long, long);
#else
#define __sync_bool_compare_and_swap_di __sync_bool_compare_and_swap
#endif

int
foo (long *x)
{
  long address = *x;
  if (!__sync_bool_compare_and_swap_di (x, address, (address | 1)))
    return 0;
  else
    return 1;
}

int
main ()
{
  long val = 0;
  int ret;
  printf ("val: 0x%lx\n", val);
  ret = foo (&val);
  printf ("ret: %d: val: 0x%lx\n", ret, val);
  return;
}
[hjl@gnu-9 gcc]$ ./xgcc -B./ -O2 /tmp/x.c
[hjl@gnu-9 gcc]$ ./a.out
val: 0x0
ret: 1: val: 0x1
[hjl@gnu-9 gcc]$ ./xgcc -B./ -O2 /tmp/x.c -m32
/tmp/ccQy8ACO.o: In function `foo':
x.c:(.text+0x1c): undefined reference to `__sync_bool_compare_and_swap_4'
collect2: ld returned 1 exit status

-- 
           Summary: __sync_bool_compare_and_swap doesn't work with -m32
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hjl at lucon dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21097


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]