Hello,
my gcc is my own built:

$ c++ -v
Using built-in specs.
Target: i386-pc-solaris2.11
Configured with: ../gcc-4.4.2/configure --prefix=/usr/local/gcc-4.4.2
--with-as=/usr/bin/gas --with-gnu-as --with-ld=/usr/bin/ld --without-gnu-ld
--enable-shared --enable-threads --enable-languages=c++
--with-gmp-include=/usr/include/gmp --with-mpfr-include=/usr/include/mpfr
Thread model: posix
gcc version 4.4.2 (GCC) 

I'm trying to compile as simple as possible __sync_fetch_and_add testcase:

#include <iostream>

using namespace std;

int
main()
{
  int x = 2;
  int y = __sync_fetch_and_add(&x, 1);
  cerr << "y: " << y << endl;
  return y;
}

but the problem is that linking of this fails:

$ c++ sync_fetch_and_add_test.cc 
Undefined                       first referenced
 symbol                             in file
__sync_fetch_and_add_4              /var/tmp//cc17aqlv.o
ld: fatal: symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status

I've tried the same on OpenSuSE 11.2 with distro provided GNU C++ 4.4.1 and the
testcase links fine. Is there any known issue why GNU C++ does not support this
on OpenSolaris 2009.06?
Thanks!
Karel


-- 
           Summary: Using __sync_fetch_and_add produces linking errors on
                    OpenSolaris
           Product: gcc
           Version: 4.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kgardas at objectsecurity dot com
 GCC build triplet: i386-pc-solaris2.11
  GCC host triplet: i386-pc-solaris2.11
GCC target triplet: i386-pc-solaris2.11


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

Reply via email to