public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/21097] New: __sync_bool_compare_and_swap doesn't work with -m32
@ 2005-04-18 22:32 hjl at lucon dot org
  2005-04-18 22:33 ` [Bug target/21097] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: hjl at lucon dot org @ 2005-04-18 22:32 UTC (permalink / raw)
  To: gcc-bugs

[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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/21097] __sync_bool_compare_and_swap doesn't work with -m32
  2005-04-18 22:32 [Bug target/21097] New: __sync_bool_compare_and_swap doesn't work with -m32 hjl at lucon dot org
@ 2005-04-18 22:33 ` pinskia at gcc dot gnu dot org
  2005-04-19 16:21 ` rth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-18 22:33 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rth at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/21097] __sync_bool_compare_and_swap doesn't work with -m32
  2005-04-18 22:32 [Bug target/21097] New: __sync_bool_compare_and_swap doesn't work with -m32 hjl at lucon dot org
  2005-04-18 22:33 ` [Bug target/21097] " pinskia at gcc dot gnu dot org
@ 2005-04-19 16:21 ` rth at gcc dot gnu dot org
  2005-04-19 16:28 ` hjl at lucon dot org
  2005-04-19 19:34 ` rth at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-04-19 16:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2005-04-19 16:21 -------
When, exactly, did you think that cmpxchg was added?  Use -march=i486.  Duh.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/21097] __sync_bool_compare_and_swap doesn't work with -m32
  2005-04-18 22:32 [Bug target/21097] New: __sync_bool_compare_and_swap doesn't work with -m32 hjl at lucon dot org
  2005-04-18 22:33 ` [Bug target/21097] " pinskia at gcc dot gnu dot org
  2005-04-19 16:21 ` rth at gcc dot gnu dot org
@ 2005-04-19 16:28 ` hjl at lucon dot org
  2005-04-19 19:34 ` rth at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: hjl at lucon dot org @ 2005-04-19 16:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From hjl at lucon dot org  2005-04-19 16:28 -------
But there is no __sync_bool_compare_and_swap_4 in source code.
If it isn't available, shouldn't gcc leave __sync_bool_compare_and_swap
alone.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/21097] __sync_bool_compare_and_swap doesn't work with -m32
  2005-04-18 22:32 [Bug target/21097] New: __sync_bool_compare_and_swap doesn't work with -m32 hjl at lucon dot org
                   ` (2 preceding siblings ...)
  2005-04-19 16:28 ` hjl at lucon dot org
@ 2005-04-19 19:34 ` rth at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-04-19 19:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2005-04-19 19:34 -------
No, because __sync_bool_compare_and_swap is overloaded.
This expansion to __sync_bool_compare_and_swap_N is documented.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-04-19 19:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-18 22:32 [Bug target/21097] New: __sync_bool_compare_and_swap doesn't work with -m32 hjl at lucon dot org
2005-04-18 22:33 ` [Bug target/21097] " pinskia at gcc dot gnu dot org
2005-04-19 16:21 ` rth at gcc dot gnu dot org
2005-04-19 16:28 ` hjl at lucon dot org
2005-04-19 19:34 ` rth at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).