Bug#791418: Compilation error for code including random, algorithm or limits.h
Rafael Stahl
rafael_stahl at t-online.de
Sat Jul 4 14:06:38 UTC 2015
Package: iwyu
Version: 3.4-1
X-Debbugs-Cc: rafael_stahl at t-online.de
Hello,
this bug is reported to debian, because it looks like a packaging issue
rather than a bug in iwyu itself.
When trying to compile a file containing the following headers iwyu
fails to compile the file:
- <random> introduced in C++11
- <algorithm> only in C++11 mode because it includes <random> there
- <limits.h>
GCC and clang are working fine on this system.
Rafael Stahl
--------------------------------------------------------------------------
Full output:
user1 at debj:~/include-what-you-use$ cat main.cpp
#include <random>
int main() {}
user1 at debj:~/include-what-you-use$ gcc -std=c++11 main.cpp
user1 at debj:~/include-what-you-use$ clang -std=c++11 main.cpp
user1 at debj:~/include-what-you-use$ iwyu -v --std=c++11 main.cpp
Debian clang version 3.4-2 (tags/RELEASE_34/final) (based on LLVM 3.4)
Target: x86_64-pc-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.2
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
clang invocation:
"/usr/bin/include-what-you-use" "-cc1" "-triple" "x86_64-pc-linux-gnu"
"-fsyntax-only" "-disable-free" "-disable-llvm-verifier"
"-main-file-name" "main.cpp" "-mrelocation-model" "static"
"-mdisable-fp-elim" "-fmath-errno" "-masm-verbose"
"-mconstructor-aliases" "-munwind-tables" "-fuse-init-array"
"-target-cpu" "x86-64" "-target-linker-version" "2.24" "-v"
"-resource-dir" "/usr/bin/../lib/clang/3.4" "-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/x86_64-linux-gnu"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/backward"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/usr/bin/../lib/clang/3.4/include" "-internal-externc-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/4.9/include" "-internal-externc-isystem"
"/usr/include/x86_64-linux-gnu" "-internal-externc-isystem" "/include"
"-internal-externc-isystem" "/usr/include" "--std=c++11"
"-fdeprecated-macro" "-fdebug-compilation-dir"
"/home/user1/include-what-you-use" "-ferror-limit" "19"
"-fmessage-length" "100" "-mstackrealign" "-fobjc-runtime=gcc"
"-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option"
"-fcolor-diagnostics" "-vectorize-slp" "-x" "c++" "main.cpp"
clang -cc1 version 3.4 based upon LLVM 3.4 default target
x86_64-pc-linux-gnu
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/bin/../lib/clang/3.4/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/backward
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/4.9/include
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
In file included from main.cpp:1:
In file included from
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/random:50:
In file included from
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9/bits/opt_random.h:33:
In file included from
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/x86intrin.h:27:
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/ia32intrin.h:41:10: error: use
of undeclared identifier
'__builtin_ia32_bsrsi'
return __builtin_ia32_bsrsi (__X);
^
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/ia32intrin.h:98:10: error: use
of undeclared identifier
'__builtin_ia32_rdpmc'
return __builtin_ia32_rdpmc (__S);
^
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/ia32intrin.h:106:10: error:
use of undeclared identifier
'__builtin_ia32_rdtsc'
return __builtin_ia32_rdtsc ();
^
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/ia32intrin.h:114:10: error:
use of undeclared identifier
'__builtin_ia32_rdtscp'
return __builtin_ia32_rdtscp (__A);
^
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/ia32intrin.h:122:10: error:
use of undeclared identifier
'__builtin_ia32_rolqi'
return __builtin_ia32_rolqi (__X, __C);
^
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/ia32intrin.h:130:10: error:
use of undeclared identifier
'__builtin_ia32_rolhi'
return __builtin_ia32_rolhi (__X, __C);
^
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/ia32intrin.h:146:10: error:
use of undeclared identifier
'__builtin_ia32_rorqi'
return __builtin_ia32_rorqi (__X, __C);
^
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/ia32intrin.h:154:10: error:
use of undeclared identifier
'__builtin_ia32_rorhi'; did you mean '__builtin_ia32_por'?
return __builtin_ia32_rorhi (__X, __C);
^
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/ia32intrin.h:41:10: note:
'__builtin_ia32_por' declared
here
return __builtin_ia32_bsrsi (__X);
^
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/ia32intrin.h:154:32: error:
cannot initialize a parameter
of type '__attribute__((__vector_size__(1 * sizeof(long long))))
long long' with an lvalue of
type 'unsigned short'
return __builtin_ia32_rorhi (__X, __C);
^~~
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/ia32intrin.h:170:3: error: use
of undeclared identifier
'__builtin_ia32_pause'
__builtin_ia32_pause ();
^
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/ia32intrin.h:187:10: error:
use of undeclared identifier
'__builtin_ia32_bsrdi'
return __builtin_ia32_bsrdi (__X);
^
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/ia32intrin.h:246:10: error:
use of undeclared identifier
'__builtin_ia32_readeflags_u64'
return __builtin_ia32_readeflags_u64 ();
^
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/ia32intrin.h:254:3: error: use
of undeclared identifier
'__builtin_ia32_writeeflags_u64'
__builtin_ia32_writeeflags_u64 (X);
^
In file included from main.cpp:1:
In file included from
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/random:50:
In file included from
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9/bits/opt_random.h:33:
In file included from
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/x86intrin.h:31:
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/xmmintrin.h:127:19: error: use
of undeclared identifier
'__builtin_ia32_addss'
return (__m128) __builtin_ia32_addss ((__v4sf)__A, (__v4sf)__B);
^
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/xmmintrin.h:133:19: error: use
of undeclared identifier
'__builtin_ia32_subss'
return (__m128) __builtin_ia32_subss ((__v4sf)__A, (__v4sf)__B);
^
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/xmmintrin.h:139:19: error: use
of undeclared identifier
'__builtin_ia32_mulss'
return (__m128) __builtin_ia32_mulss ((__v4sf)__A, (__v4sf)__B);
^
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/xmmintrin.h:145:19: error: use
of undeclared identifier
'__builtin_ia32_divss'; did you mean '__builtin_ia32_minss'?
return (__m128) __builtin_ia32_divss ((__v4sf)__A, (__v4sf)__B);
^
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/ia32intrin.h:41:10: note:
'__builtin_ia32_minss' declared
here
return __builtin_ia32_bsrsi (__X);
^
In file included from main.cpp:1:
In file included from
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/random:50:
In file included from
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9/bits/opt_random.h:33:
In file included from
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/x86intrin.h:31:
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/xmmintrin.h:183:19: error: use
of undeclared identifier
'__builtin_ia32_addps'; did you mean '__builtin_ia32_haddps'?
return (__m128) __builtin_ia32_addps ((__v4sf)__A, (__v4sf)__B);
^
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/xmmintrin.h:127:19: note:
'__builtin_ia32_haddps' declared
here
return (__m128) __builtin_ia32_addss ((__v4sf)__A, (__v4sf)__B);
^
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/xmmintrin.h:189:19: error: use
of undeclared identifier
'__builtin_ia32_subps'; did you mean '__builtin_ia32_hsubps'?
return (__m128) __builtin_ia32_subps ((__v4sf)__A, (__v4sf)__B);
^
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/xmmintrin.h:133:19: note:
'__builtin_ia32_hsubps' declared
here
return (__m128) __builtin_ia32_subss ((__v4sf)__A, (__v4sf)__B);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
main.cpp should add these lines:
main.cpp should remove these lines:
- #include <random> // lines 1-1
The full include-list for main.cpp:
---
--------------------------------------------------------------------------
With limits.h:
user1 at debj:~/include-what-you-use$ cat main.cpp
#include <limits.h>
int main() {}
user1 at debj:~/include-what-you-use$ iwyu main.cpp
In file included from main.cpp:1:
/usr/include/limits.h:123:16: fatal error: 'limits.h' file not found
# include_next <limits.h>
^
main.cpp should add these lines:
main.cpp should remove these lines:
- #include <limits.h> // lines 1-1
The full include-list for main.cpp:
---
--------------------------------------------------------------------------
System Information:
Debian 8.1 amd64
user1 at debj:~/include-what-you-use$ gcc --version
gcc (Debian 4.9.2-10) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
user1 at debj:~/include-what-you-use$ clang --version
Debian clang version 3.5.0-10 (tags/RELEASE_350/final) (based on LLVM 3.5.0)
Target: x86_64-pc-linux-gnu
Thread model: posix
More information about the Pkg-llvm-team
mailing list