This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug bootstrap/54419] [4.8 Regression] Compiling libstdc++-v3/src/c++11/random.cc fails on platforms not knowing rdrand


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

--- Comment #47 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2012-09-06 16:01:09 UTC ---
The test in comment #20 is

/* end confdefs.h.  */

int
main ()
{
void f(void){asm("rdrand %eax");}
  ;
  return 0;
}

I have compiled it with clang 1.7 and gcc 4.4.6, 4.5.3, 4.6.3, 4.7.1, and 4.8.0
r191013 with
'-O0 -fdump-tree-all rdrand.c -save-temps'.

clang gives

In file included from rdrand.c:1:
rdrand.c:6:13: error: expected ';' at end of declaration
void f(void){asm("rdrand %eax");}
            ^
            ;
1 error generated.

gcc 4.4 and 4.5 gives

rdrand.c:6:no such instruction: `rdrand %eax'

and "grep rdrand rdrand.c.*"

rdrand.c.001t.tu:@2761   function_decl    name: @2768    type: @2769    srcp:
rdrand.c:4      
rdrand.c.001t.tu:                         srcp: rdrand.c:6              link:
static  
rdrand.c.001t.tu:@2800   result_decl      type: @3       scpe: @2761    srcp:
rdrand.c:4      
rdrand.c.003t.original:  __asm__ __volatile__("rdrand %eax"::);
rdrand.c.004t.gimple:  __asm__ __volatile__("rdrand %eax");
rdrand.c.005t.nested:  __asm__ __volatile__("rdrand %eax");
rdrand.c.008t.omplower:  __asm__ __volatile__("rdrand %eax");
rdrand.c.009t.lower:  __asm__ __volatile__("rdrand %eax");
rdrand.c.011t.eh:  __asm__ __volatile__("rdrand %eax");
rdrand.c.012t.cfg:  __asm__ __volatile__("rdrand %eax");
rdrand.c.013t.veclower:  __asm__ __volatile__("rdrand %eax");
rdrand.c.021t.cleanup_cfg:  __asm__ __volatile__("rdrand %eax");
rdrand.c.023t.ssa:  __asm__ __volatile__("rdrand %eax");
rdrand.c.024t.einline2:  __asm__ __volatile__("rdrand %eax");
rdrand.c.040t.release_ssa:  __asm__ __volatile__("rdrand %eax");
rdrand.c.135t.cplxlower0:  __asm__ __volatile__("rdrand %eax");
rdrand.c.140t.optimized:  __asm__ __volatile__("rdrand %eax");

(with a bunch of additional hit in rdrand.c.001t.tu for 4.4).

For gcc 4.6 and above the test compiles without error and "grep rdrand
rdrand.c.*" gives

rdrand.c.001t.tu:                         srcp: rdrand.c:4              link:
extern  
rdrand.c.001t.tu:                         srcp: rdrand.c:6              link:
static  
rdrand.c.001t.tu:@2807   result_decl      type: @3       scpe: @2768    srcp:
rdrand.c:4      
rdrand.c.003t.original:  __asm__ __volatile__("rdrand %eax"::);
rdrand.c.005t.nested:  __asm__ __volatile__("rdrand %eax");

i.e., "f(void){asm("rdrand %eax");}" is discarded after rdrand.c.005t.nested.
If someone thinks it is a [4.6/4.7/4.8 Regression] or a new undocumented
feature, please read the end of comment #33!

I have tried to bootstrap 191018 with the patch in comment #20 and gcc 4.4
(which fails the test for rdrand) and it failed with "no such instruction:
`rdrand %eax'". I think this answer the concern expressed by Marc in comment
#29: the bootstrapping compiler is not used for the tests in
libstdc++-v3/configure (am I wrong to assume that they use the new built one?).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]