[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#803545: C++ header <algorithm> includes AES intrinsics



Control: tags -1 + moreinfo

 - what does -march=native translates to?
 - please include the preprocessed source

On 31.10.2015 10:10, Jeffrey Walton wrote:
Package: g++
Version: 4:4.9.2-2
Severity: normal

**********

I'm catching a compile failure when building a library (not a
program). The library is a crypto library called Crypto++
(https://cryptopp.com). Here's the project's bug report on the issue:
https://github.com/weidai11/cryptopp/issues/53 .

It appears GCC's <algorithm> is including system files that include
AES intrinsics. Here's what one of the errors looks like:

$ g++ -DDEBUG -g2 -O2 -std=c++11  -fPIC -march=native -pipe -c cpu.cpp
cryptlib.h:864:39: error: ‘__m128i _mm_aesdeclast_si128(__m128i,
__m128i)’ conflicts with a previous declaration
   class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE BufferedTransformation :
public Algorithm, public Waitable
                                    ^
In file included from
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/x86intrin.h:43:0,
              from /usr/include/x86_64-linux-gnu/c++/4.9/bits/opt_random.h:33,
              from /usr/include/c++/4.9/random:50,
              from /usr/include/c++/4.9/bits/stl_algo.h:66,
              from /usr/include/c++/4.9/algorithm:62,
              from stdcpp.h:13,
              from cryptlib.h:85,
              from misc.h:11,
              from cpu.cpp:13:
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/wmmintrin.h:52:1: note:
previous declaration ‘__m128i _mm_aesdeclast_si128(__m128i, __m128i)’
  _mm_aesdeclast_si128 (__m128i __X, __m128i __Y)
  ^
In file included from cpu.cpp:12:0:
cpu.h:89:1: note: -fabi-version=6 (or =0) avoids this error with a
change in mangling
  _mm_aesdeclast_si128 (__m128i a, __m128i b)
  ^

**********

We test a matrix of configurations (debug, release, C++03/C++11,
santiziers, optimizations, etc). The issue shows up whenever C++11 is
used. C++03 is OK.

Something tastes a little off here. I've never seen this issue before.


**********

$ uname -a
Linux core2 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u5
(2015-10-09) x86_64 GNU/Linux

$ lsb_release
No LSB modules are available.

**********

Possibly related (due to "note: -fabi-version=6 (or =0)..."):

* [Bug 65919] - GCC 5.1 with options "-g -std=c++14" fails to compile
multiple lambdas used as default function parameters,
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65919
* [Bug 42748] - warnings about 'mangling of 'va_list' has changed in
GCC 4.4' not suppressed in sytem headers,
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42748

**********

$ apt-cache show g++
Package: g++
Source: gcc-defaults (1.136)
Version: 4:4.9.2-2
Installed-Size: 34
Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
Architecture: amd64
Provides: c++-compiler
Depends: cpp (>= 4:4.9.2-2), gcc (>= 4:4.9.2-2), g++-4.9 (>=
4.6.4-1~), gcc-4.9 (>= 4.6.4-1~)
Suggests: g++-multilib
Description-en: GNU C++ compiler
  This is the GNU C++ compiler, a fairly portable optimizing compiler for C++.
  .
  This is a dependency package providing the default GNU C++ compiler.
Description-md5: 4d44b18774ae5123b7c3f70d940cf655
Build-Essential: yes
Tag: devel::compiler, devel::lang:c++, implemented-in::c,
  interface::commandline, role::dummy, role::metapackage, suite::gnu,
  works-with::software:source
Section: devel
Priority: optional
Filename: pool/main/g/gcc-defaults/g++_4.9.2-2_amd64.deb
Size: 1530
MD5sum: cd4aa68ba8cf582df806c324988e6a00
SHA1: 82a50c84e1105e1f0c767da82c09f2398ac2d4b2
SHA256: 6fb9842c6a0ad0cd5445b9f2f2cb3f738abcc83a6b8e0900aad441574f5cecee



Reply to: