This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/68316] New: GCC C++ compiler cannot compile a program using RDESED intrinsics
- From: "noloader at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 12 Nov 2015 16:39:52 +0000
- Subject: [Bug c++/68316] New: GCC C++ compiler cannot compile a program using RDESED intrinsics
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68316
Bug ID: 68316
Summary: GCC C++ compiler cannot compile a program using RDESED
intrinsics
Product: gcc
Version: 5.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: noloader at gmail dot com
Target Milestone: ---
According the Intel docs, RDSEED intrinsics are available in <immintrin.h>.
Confer,
http://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=rdseed.
However, GCC cannot compile a program using RDSEED and the advertised header.
The same program compiles fine using RDRAND.
It appears the header needed (in this case) is <x86intrin.h>, which does not
appear to be documented anywhere other than this grep:
$ grep -R rdseed /usr/include
/usr/include/clang/3.4/include/rdseedintrin.h:#error "Never use
<rdseedintrin.h> directly; include <x86intrin.h> instead."
^
This affects GCC 4.8 and 5.2, perhaps more.
**********
$ cat rdseed.cxx
#include <iostream>
#include <immintrin.h>
int main()
{
unsigned long long val = 0;
_rdseed64_step(&val);
_rdseed32_step(&val);
_rdseed16_step(&val);
std::cout << val << std::endl;
return !val;
}
$ g++ -mrdseed rdseed.cxx -o rdseed.exe
rdseed.cxx: In function âint main()â:
rdseed.cxx:7:22: error: â_rdseed64_stepâ was not declared in this scope
_rdseed64_step(&val);
^
rdseed.cxx:8:22: error: â_rdseed32_stepâ was not declared in this scope
_rdseed32_step(&val);
^
rdseed.cxx:9:22: error: â_rdseed16_stepâ was not declared in this scope
_rdseed16_step(&val);
^
**********
$ g++ --version
g++ (Debian 5.2.1-20) 5.2.1 20151002
$ g++ --version
g++ (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
**********
Adding a __has_include to guard <x86intrin.h> appears to open another can of
worms:
$ g++ -mrdseed rdseed.cxx -o rdseed.exe
rdseed.cxx:4:45: error: missing binary operator before token "("
#if defined(__has_include) && (__has_include(<x86intrin.h>))
^