http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46822
Summary: printf( "%f" ) segv when called from pthread_once Product: gcc Version: 4.5.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: isdm...@gmail.com Created attachment 22658 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22658 A 20 line source code that triggers the bug Hi, I noticed that a simple call to printf for a double argument always crashes my program exclusively when called inside a pthread_once function. The call succeeds in other cases. The crash occurs for many different versions of GCC (3.3.6, 3.4.6, 4.1.2, 4.3.1, 4.3.2, 4.4.2 and 4.5.1) and also for various printf-like functions (sprintf, snprintf, etc.). Thanks. Isdmter Configuration: GCC 4.5.1: Using built-in specs. COLLECT_GCC=/local00/home/isdmter/products/gcc-4.5.1/bin/gcc COLLECT_LTO_WRAPPER=/local00/home/isdmter/products/gcc-4.5.1/libexec/gcc/x86_64-linux-gnu/4.5.1/lto-wrapper Target: x86_64-linux-gnu Configured with: ./configure -v --enable-languages=c,c++,fortran --enable-gold --enable-shared --without-included-gettext --enable-threads=posix --enable-nls --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-gmp --enable-checking=release x86_64-linux-gnu --with-gmp-include=/local00/home/isdmter/products/gmp-5.0.1/include --with-gmp-lib=/local00/home/isdmter/products/gmp-5.0.1/lib --with-mpfr-include=/local00/home/isdmter/products/mpfr-3.0.0/include --with-mpfr-lib=/local00/home/isdmter/products/mpfr-3.0.0/lib --with-mpc-include=/local00/home/isdmter/products/mpc-0.8.2/include --with-mpc-lib=/local00/home/isdmter/products/mpc-0.8.2/lib --prefix=/local00/home/isdmter/products/gcc-4.5.1 --disable-multilib --disable-bootstrap --with-system-zlib LDFLAGS='-Wl,-rpath -Wl,/local00/home/isdmter/products/gmp-5.0.1/lib -Wl,-rpath -Wl,/local00/home/isdmter/products/mpfr-3.0.0/lib -Wl,-rpath -Wl,/local00/home/isdmter/products/mpc-0.8.2/lib' Thread model: posix gcc version 4.5.1 (GCC) System: Debian etch Linux 2.6.18-4-amd64 #1 SMP Fri May 4 00:37:33 UTC 2007 x86_64 GNU/Linux Commands to reproduce the bug: $ gcc -Wall -save-temps -o main -pthread -lpthread main.c $ ./main