How to clear compile error when using rdrand64_step due to typedef'ing a 64-bit type?

Jeffrey Walton
Sun Jul 31 11:01:00 GMT 2016

I'm catching a compile error when using rdrand64_step on x86_64. If I
change the typedef to use 'unsigned long long', then I catch a compile
error under AArch64 when using NEON intrinsics.

How should I clear the compile error in a way that does not lead to
additional breaks?

Thanks in advance.



$ cat
#include <x86intrin.h>

#if _LP64 || __LP64__
typedef unsigned long my_u64;
typedef unsigned long long my_u64;

int main(int argc, char* argv[])
  my_u64 val;

  return 0;

$ gcc -mrdrnd -o test.exe In function ‘int main(int, char**)’: error: invalid conversion from ‘my_u64* {aka long
unsigned int*}’ to ‘long long unsigned int*’ [-fpermissive]
In file included from
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/immintrin.h:166:1: note:
initializing argument 1 of ‘int _rdrand64_step(long long unsigned
 _rdrand64_step (unsigned long long *__P)


Intel's declaration is (

    extern int _rdrand64_step(unsigned __int64 *random_val);


$ grep -R 'unsigned __int64' /usr/lib/gcc/x86_64-linux-gnu/4.9/include
| grep typedef
typedef unsigned __int64 uint64_t;

$ grep -R 'uint64_t' /usr/lib/gcc/x86_64-linux-gnu/4.9/include | grep typedef
__UINT64_TYPE__ uint64_t;
typedef unsigned __int64 uint64_t;

The trail ends at __UINT64_TYPE__. I can't find what its defined as.

More information about the Gcc-help mailing list