public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/34115]  New: atomic builtins not supported on i686?
@ 2007-11-15 22:15 scovich at gmail dot com
  2007-11-15 22:19 ` [Bug target/34115] " pinskia at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: scovich at gmail dot com @ 2007-11-15 22:15 UTC (permalink / raw)
  To: gcc-bugs

Linking fails for the program below, with the error:

undefined reference to `___sync_val_compare_and_swap_4'

// gcc -Wall atomic.c
int main() {
  int *a, b, c;
  return __sync_val_compare_and_swap(a, b, c);
}

According to the atomic builtins docs (), "Not all operations are supported by
all target processors. If a particular operation cannot be implemented on the
target processor, a warning will be generated and a call an external function
will be generated. The external function will carry the same name as the
builtin, with an additional suffix `_n' where n is the size of the data type."

If CAS is not supported, how come I don't get a warning? Why would i686 *not*
support compare and swap? The cmpxchg instruction has been around since 80486,
according to the intel IA-32 processor manual. 

Also, does an unsupported builtin mean the user is responsible to write that
function, or simply that the compiler must make a function call to synthesize
its behavior?

FWIW, my x86_64 cross-compile gcc 4.2.0 handles it fine, emitting a
"lock"+"cmpxchg" pair.


-- 
           Summary: atomic builtins not supported on i686?
           Product: gcc
           Version: 4.2.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: scovich at gmail dot com
  GCC host triplet: i686-pc-cygwin


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


^ permalink raw reply	[flat|nested] 13+ messages in thread
[parent not found: <bug-34115-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2021-09-12  8:16 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-15 22:15 [Bug c/34115] New: atomic builtins not supported on i686? scovich at gmail dot com
2007-11-15 22:19 ` [Bug target/34115] " pinskia at gcc dot gnu dot org
2007-11-15 22:30 ` pcarlini at suse dot de
2007-11-15 23:53 ` joseph at codesourcery dot com
2007-11-16  0:07 ` pcarlini at suse dot de
2007-11-16  1:00 ` scovich at gmail dot com
2007-11-16  1:04 ` scovich at gmail dot com
2007-11-28  1:56 ` scovich at gmail dot com
2007-11-28  2:05 ` pcarlini at suse dot de
2007-11-28 14:20 ` scovich at gmail dot com
2009-06-08 21:18 ` joseph dot h dot garvin at gmail dot com
     [not found] <bug-34115-4@http.gcc.gnu.org/bugzilla/>
2010-10-15 20:48 ` redi at gcc dot gnu.org
2021-09-12  8:16 ` pinskia at gcc dot gnu.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).