This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/56298] New: wmmintrin.h aborts compilation on the machines without AES
- From: "piotr.wyderski at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 12 Feb 2013 12:57:50 +0000
- Subject: [Bug other/56298] New: wmmintrin.h aborts compilation on the machines without AES
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56298
Bug #: 56298
Summary: wmmintrin.h aborts compilation on the machines without
AES
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: other
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: piotr.wyderski@gmail.com
I have a piece of C++ code which computes a hash function
using the AES-NI extensions of the Sandy/IvyBridge x64 processors.
It is automatically selected if the target platform supports the
mentioned extensions via cpuid. To use e.g. _mm_aesenc_si128()
one needs to include <wmmintrin.h>, which is also a full test
case here. If the host does not implement AES-NI (detected via
-march=native or it is not explicitly enabled by -maes), the
compilation process fails abruptly due to the content of wmmintrin.h:
#if !defined (__AES__) && !defined (__PCLMUL__)
# error "AES/PCLMUL instructions not enabled"
#else
It is a very serious bug (so I decided to mark is as "major"),
because the intrinsics available should not depend on command
line settings -- it is the user who takes full responsibility
for their correct use and availability checking, as it is in
my case. Enabling -maes is not an option, because it would then
allow the code generator to unconditionally emit the AES-NI
instructions in places I don't control, which will result in
SIGILL and a core dump. This bug probably applies to all
recent GCC versions, including 4.7.2 and 4.6.3.
On MSVC2010 the respective header contains no such compile-time
checks, i.e. it is fully consistent with the intended behaviour
described above:
/*
* wmmintrin.h
*
* Principal header file for Intel(R) AES and PCLMULQDQ intrinsics.
*/
#pragma once
#ifndef __midl
#ifndef _INCLUDED_WMM
#define _INCLUDED_WMM
#if defined(_M_CEE_PURE)
#error ERROR: EMM intrinsics not supported in the pure mode!
#else
#include <nmmintrin.h>
#if __cplusplus
extern "C" {
#endif
/*
* Performs 1 round of AES decryption of the first m128i using
* the second m128i as a round key.
*/
extern __m128i _mm_aesdec_si128(__m128i v, __m128i rkey);
etc.