This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/37651] New: __sync_bool_compare_and_swap creates wrong code with -fPIC
- From: "fm3 at os dot inf dot tu-dresden dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Sep 2008 19:45:07 -0000
- Subject: [Bug target/37651] New: __sync_bool_compare_and_swap creates wrong code with -fPIC
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following example dumps a core if compiled with -march=i586 -fPIC:
#include <stdint.h>
int main(void)
{
static uint64_t volatile s_u64;
__sync_bool_compare_and_swap(&s_u64, 0, 0);
}
The reason is that %ebx will be used as pointer for the memory variable.
I can reproduce this bug so far with gcc-4.2 and gcc-4.3.2 (both Debian Sid).
$ gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.2-1'
--with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3
--program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug
--enable-objc-gc --enable-mpfr --enable-targets=all --enable-cld
--enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu
--target=i486-linux-gnu
Thread model: posix
gcc version 4.3.2 (Debian 4.3.2-1)
--
Summary: __sync_bool_compare_and_swap creates wrong code with -
fPIC
Product: gcc
Version: 4.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: fm3 at os dot inf dot tu-dresden dot de
GCC build triplet: i486-linux-gnu
GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37651