diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/other/pr59492.C')
-rw-r--r-- | gcc/testsuite/g++.dg/other/pr59492.C | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/other/pr59492.C b/gcc/testsuite/g++.dg/other/pr59492.C new file mode 100644 index 0000000000..84bd25554f --- /dev/null +++ b/gcc/testsuite/g++.dg/other/pr59492.C @@ -0,0 +1,18 @@ +// { dg-do assemble { target { { i?86-*-* x86_64-*-* } && fpic } } } +// { dg-options "-mx32 -fPIC" } +// { dg-require-ifunc "" } +// { dg-require-effective-target maybe_x32 } + +void +__throw_runtime_error(const char*) __attribute__((__noreturn__)); +unsigned int +__attribute__ ((target("rdrnd"))) +__x86_rdrand(void) +{ + unsigned int retries = 100; + unsigned int val; + while (__builtin_ia32_rdrand32_step(&val) == 0) + if (--retries == 0) + __throw_runtime_error(("random_device::__x86_rdrand(void)")); + return val; +} |