------- Comment #10 from joseph dot h dot garvin at gmail dot com  2009-06-08 
21:18 -------
After encountering this issue and some testing, I think this is definitely a
bug. The problem ONLY occurs when directly returning a call to an atomic
builtin! Assuming no march flags:

Links:

int main()
{
        unsigned long test;
        return __sync_add_and_fetch(&test, 1);

        return (int)test;
}

Does not link:

int main()
{
        unsigned long test;
        return __sync_add_and_fetch(&test, 1);
}

If you do specify -march=i686, then they both link! If this somehow isn't a
bug, the design is poor, because it's very hard to debug behavior.

$  gcc -v
Reading specs from
/opt/app/g++lib6/gcc-4.2/lib/gcc/i386-pc-solaris2.10/4.2.2/specs
Target: i386-pc-solaris2.10
Configured with: ../configure --prefix=/opt/app/g++lib6/gcc-4.2
--enable-languages=c,c++,fortran,objc --disable-nls --with-included-gettext
--with-gnu-as --with-as=/usr/sfw/bin/gas --with-target-tools=/usr/sfw/bin/
--with-gmp=/opt/app/nonc++/gmp-4.2 --with-mpfr=/opt/app/nonc++/mpfr-2.3
Thread model: posix
gcc version 4.2.2


-- 

joseph dot h dot garvin at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |joseph dot h dot garvin at
                   |                            |gmail dot com


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

Reply via email to