From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4173 invoked by alias); 4 Sep 2012 15:57:51 -0000 Received: (qmail 4162 invoked by uid 22791); 4 Sep 2012 15:57:50 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED,TW_CX X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 04 Sep 2012 15:57:37 +0000 From: "dominiq at lps dot ens.fr" To: gcc-bugs@gcc.gnu.org Subject: [Bug bootstrap/54419] [4.8 Regression] Compiling libstdc++-v3/src/c++11/random.cc fails on platforms not knowing rdrand Date: Tue, 04 Sep 2012 15:57:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: bootstrap X-Bugzilla-Keywords: X-Bugzilla-Severity: blocker X-Bugzilla-Who: dominiq at lps dot ens.fr X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.0 X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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: 2012-09/txt/msg00255.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54419 --- Comment #24 from Dominique d'Humieres 2012-09-04 15:56:17 UTC --- As such, the patch in commen #20 does not work: (1) on x86_64-apple-darwin10 it gives [macbook] gcc/p_build% grep -r rdr x86_64-apple-darwin10.8.0/*/config.log x86_64-apple-darwin10.8.0/libstdc++-v3/config.log:ac_cv_x86_rdrand=yes AFAICT this is due to the fact that "void f(void){asm("rdrand %eax");}" is optimized out, thus the test passes. Before reading comment #22, I have tested cat confdefs.h - <<_ACEOF >conftest.$ac_ext void f(void){asm("rdrand %eax");} _ACEOF which gives x86_64-apple-darwin10.8.0/libstdc++-v3/config.log:conftest.c:167:no such instruction: `rdrand %eax' x86_64-apple-darwin10.8.0/libstdc++-v3/config.log:| void f(void){asm("rdrand %eax");} x86_64-apple-darwin10.8.0/libstdc++-v3/config.log:ac_cv_x86_rdrand=no (2) I have asked in comment #21 > Before I test the patch, I am surprised to see that only two out of three > blocks > > #if defined __i386__ || defined __x86_64__ > > are "protected" by && defined _GLIBCXX_X86_RDRAND. Is it normal? Thanks to the quick answer, without -#if (defined __i386__ || defined __x86_64__) +#if (defined __i386__ || defined __x86_64__) && defined _GLIBCXX_X86_RDRAND bootstrap fails with ../../../../../p_work/libstdc++-v3/src/c++11/random.cc: In member function 'std::random_device::result_type std::random_device::_M_getval()': ../../../../../p_work/libstdc++-v3/src/c++11/random.cc:124:27: error: '__x86_rdrand' was not declared in this scope return __x86_rdrand(); With the two changes I have been able to bootstrap revision 190924 configured with ../p_work/configure --prefix=/opt/gcc/gcc4.8p-190924p2 --enable-languages=c,c++,lto,fortran,ada,objc,obj-c++ --with-gmp=/opt/mp --with-system-zlib --enable-checking=release --with-isl=/opt/mp --enable-lto --enable-plugin --enable-build-with-cxx I will now try to bootstrap with the following change in libstdc++-v3/configure ac_cv_x86_rdrand=no case "$target" in i?86-*-* | \ x86_64-*-*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext int main () { asm("rdrand %eax"); return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_x86_rdrand=yes else ac_cv_x86_rdrand=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext esac if test $ac_cv_x86_rdrand = yes; then $as_echo "#define _GLIBCXX_X86_RDRAND 1" >>confdefs.h fi