Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile Errors with ICC #1748

Closed
acidtonic opened this issue Sep 10, 2019 · 9 comments
Closed

Compile Errors with ICC #1748

acidtonic opened this issue Sep 10, 2019 · 9 comments

Comments

@acidtonic
Copy link

Cannot compile Catch2 with Intel ICC. Compile errors below. I am able to use the single header in my project but I cannot compile the SelfTests.

I'm trying to open a bug report from a different project that crashes the compiler, but that project's Unit Tests require Catch2 and it can't compile in their codebase in order for me to point Intel at a reproducible bug. Appreciate any help.

icc version 19.0.4.243 (gcc version 8.3.0 compatibility)
icpc version 19.0.4.243 (gcc version 8.3.0 compatibility)
4.14.61-gentoo x86_64 Intel(R) Core(TM) i7-8700K
Glibc 2.29

Scanning dependencies of target SelfTest
[  0%] Building CXX object projects/CMakeFiles/SelfTest.dir/SelfTest/TestMain.cpp.o
[  1%] Building CXX object projects/CMakeFiles/SelfTest.dir/SelfTest/IntrospectiveTests/CmdLine.tests.cpp.o
[  2%] Building CXX object projects/CMakeFiles/SelfTest.dir/SelfTest/IntrospectiveTests/Details.tests.cpp.o
[  3%] Building CXX object projects/CMakeFiles/SelfTest.dir/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp.o
[  4%] Building CXX object projects/CMakeFiles/SelfTest.dir/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp.o
[  5%] Building CXX object projects/CMakeFiles/SelfTest.dir/SelfTest/IntrospectiveTests/PartTracker.tests.cpp.o
[  6%] Building CXX object projects/CMakeFiles/SelfTest.dir/SelfTest/IntrospectiveTests/Tag.tests.cpp.o
[  7%] Building CXX object projects/CMakeFiles/SelfTest.dir/SelfTest/IntrospectiveTests/String.tests.cpp.o
[  7%] Building CXX object projects/CMakeFiles/SelfTest.dir/SelfTest/IntrospectiveTests/StringManip.tests.cpp.o
[  8%] Building CXX object projects/CMakeFiles/SelfTest.dir/SelfTest/IntrospectiveTests/Xml.tests.cpp.o
[  9%] Building CXX object projects/CMakeFiles/SelfTest.dir/SelfTest/IntrospectiveTests/ToString.tests.cpp.o
[ 10%] Building CXX object projects/CMakeFiles/SelfTest.dir/SelfTest/UsageTests/Approx.tests.cpp.o
[ 11%] Building CXX object projects/CMakeFiles/SelfTest.dir/SelfTest/UsageTests/BDD.tests.cpp.o
[ 12%] Building CXX object projects/CMakeFiles/SelfTest.dir/SelfTest/UsageTests/Benchmark.tests.cpp.o
[ 13%] Building CXX object projects/CMakeFiles/SelfTest.dir/SelfTest/UsageTests/Class.tests.cpp.o
/home/arkk/code/Catch2/projects/SelfTest/UsageTests/Class.tests.cpp(96): error: no instance of overloaded function "<unnamed>::ClassTests::<unnamed>::ns_____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____13::create" matches the argument list
            argument types are: (<unnamed>::ClassTests::<unnamed>::ns_____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____13::TypeList<<unnamed>::ClassTests::<unnamed>::ns_____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____13::Nttp<int, 2UL>, <unnamed>::ClassTests::<unnamed>::ns_____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____13::Nttp<float, 6UL>>)
  TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG(Template_Fixture_2, "A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds", "[class][template][product][nttp]", ((typename T, size_t S), T, S),(std::array, Template_Foo_2), ((int,2), (float,6)))
  ^
/home/arkk/code/Catch2/projects/SelfTest/UsageTests/Class.tests.cpp(96): note: this candidate was rejected because there is a type mismatch after argument substitution
  TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG(Template_Fixture_2, "A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds", "[class][template][product][nttp]", ((typename T, size_t S), T, S),(std::array, Template_Foo_2), ((int,2), (float,6)))
  ^
/home/arkk/code/Catch2/projects/SelfTest/UsageTests/Class.tests.cpp(96): note: this candidate was rejected because there is a type mismatch after argument substitution
  TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG(Template_Fixture_2, "A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds", "[class][template][product][nttp]", ((typename T, size_t S), T, S),(std::array, Template_Foo_2), ((int,2), (float,6)))
  ^

/home/arkk/code/Catch2/projects/SelfTest/UsageTests/Class.tests.cpp(129): error: no instance of overloaded function "<unnamed>::ClassTests::Inner::<unnamed>::ns_____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____30::create" matches the argument list
            argument types are: (<unnamed>::ClassTests::Inner::<unnamed>::ns_____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____30::TypeList<<unnamed>::ClassTests::Inner::<unnamed>::ns_____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____30::Nttp<int, 2UL>, <unnamed>::ClassTests::Inner::<unnamed>::ns_____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____30::Nttp<float, 6UL>>)
      TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG(Template_Fixture_2, "A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails", "[.][class][template][product][nttp][failing]", ((typename T, size_t S), T, S), (std::array, Template_Foo_2), ((int, 2), (float, 6)))
      ^
/home/arkk/code/Catch2/projects/SelfTest/UsageTests/Class.tests.cpp(129): note: this candidate was rejected because there is a type mismatch after argument substitution
      TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG(Template_Fixture_2, "A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails", "[.][class][template][product][nttp][failing]", ((typename T, size_t S), T, S), (std::array, Template_Foo_2), ((int, 2), (float, 6)))
      ^
/home/arkk/code/Catch2/projects/SelfTest/UsageTests/Class.tests.cpp(129): note: this candidate was rejected because there is a type mismatch after argument substitution
      TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG(Template_Fixture_2, "A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails", "[.][class][template][product][nttp][failing]", ((typename T, size_t S), T, S), (std::array, Template_Foo_2), ((int, 2), (float, 6)))
      ^

compilation aborted for /home/arkk/code/Catch2/projects/SelfTest/UsageTests/Class.tests.cpp (code 2)
make[2]: *** [projects/CMakeFiles/SelfTest.dir/build.make:245: projects/CMakeFiles/SelfTest.dir/SelfTest/UsageTests/Class.tests.cpp.o] Error 2
make[1]: *** [CMakeFiles/Makefile2:987: projects/CMakeFiles/SelfTest.dir/all] Error 2
make: *** [Makefile:163: all] Error 2

@horenmar
Copy link
Member

horenmar commented Oct 9, 2019

Those macros are quite tricky and ask the preprocessor to do a lot of heavy listing -- can you post what it preprocesses into on your machine?

@acidtonic
Copy link
Author

I tried and can't seem to get it to dump only the preprocessor output....

I may just be doing it wrong, not super familiar with only preprocessoring ;)

cmake -D CMAKE_CXX_FLAGS="-E" -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc  ../Catch2/
CMake Error at projects/CMakeLists.txt:316 (target_compile_features):
  target_compile_features no known features for CXX compiler

  "Intel"

  version 19.0.4.20190416.

@acidtonic
Copy link
Author

Should I comment out the code at 316 which looks like you guys are manually playing with features?

@acidtonic
Copy link
Author

Bueller?

@horenmar
Copy link
Member

Sorry, I skimmed the notification in my inbox, only saw this part

I tried and can't seem to get it to dump only the preprocessor output....

and placed this issue deep into the backlog.

I am kinda surprised that CMake does not know ICC, but yes, you can delete the part that sets compilation features, as long as you enable C++11 or newer for the compilation manually.

Also @JoeyGrajciar do you have ideas based on the error message?

@JoeyGrajciar
Copy link
Contributor

Never saw that error message, but tried it in Compiler Explorer with ICC 19.0.1 and reproduced the issue. Checked preprocessor output for both ICC 19.0.1 and gcc 9.2 and except for name generated with number it is exactly the same. Also correct instance of overloaded function create is present so i would suspect that there might be some issue in compiler. Will try to create smallest possible reproduction without using Catch2.

@acidtonic
Copy link
Author

I still hold a premium support contract with my purchase of ICC. If we determine this is indeed a compiler bug I can open an issue with their R&D if desired.

Appreciate the help.

@JoeyGrajciar
Copy link
Contributor

So today I found the issue and we can provide a workaround. It definitely is compiler issue it can be seen here https://godbolt.org/z/RxsLQR
For some reason compiler fails on two trailing return types with decltype

template<template <typename ...> class Final, template<typename T, size_t S> class ... Containers, typename ... Types>
constexpr auto create(TypeList<Types ...>) noexcept -> decltype(append(Final< >{}, rewrap<Containers>(Types{}...)...))
{
    return {};
}

and

template< template<typename ...> class Container, template<typename ...> class List, class ... Elems, typename ... Elements>
constexpr auto rewrap(List<Elems ...>,Elements ...) noexcept -> decltype(append(TypeList<Container<Elems ...>>{}, rewrap<Container>(Elements{}...)))
{
   return {};
}

Strangely enough other trailing return types with decltype are fine.
And here is version of code with workaround https://godbolt.org/z/WZLfHJ
Workaround is to move the code inside decltype to return statement.
Probably best would be to implement each of these functions like that.

Feel free to open issue with ICC R&D, so they can fix it and it does not occur in the future :)

@acidtonic
Copy link
Author

Logged Intel Case #04388242.

Pointed them here and to the CompilerExplorer links. I'll update as the case progresses. Thanks everyone!

jorblancoa pushed a commit to BlueBrain/spack that referenced this issue May 8, 2020
 - Avoid bug when compiling with intel (catchorg/Catch2#1748)
jorblancoa added a commit to BlueBrain/spack that referenced this issue May 8, 2020
- Avoid bug when compiling with intel (catchorg/Catch2#1748)

Co-authored-by: Blanco Alonso Jorge <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants