From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23315 invoked by alias); 8 Jun 2009 21:18:55 -0000 Received: (qmail 23285 invoked by uid 48); 8 Jun 2009 21:18:41 -0000 Date: Mon, 08 Jun 2009 21:18:00 -0000 Message-ID: <20090608211841.23284.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug target/34115] atomic builtins not supported on i686? In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "joseph dot h dot garvin at gmail dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-06/txt/msg00500.txt.bz2 ------- 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