Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

icc bug while compiling fmtlib

Wiener__Rafi
Beginner
1,003 Views

Hi,

I tried compiling fmtlib (a text formatter library) with ICC v15-v17.

it compiles well with gcc4.8.5+ and clang but icc reported issues.

i opened an issue in their github and found a workaround for compilation of the core library, but not for the fmtlib tests.

the developer suggested to update the intel team since he thinks it's an ICC bug.

you can see the full discussion here

https://github.com/fmtlib/fmt/issues/822

Thanks Rafi

0 Kudos
9 Replies
Viet_H_Intel
Moderator
1,003 Views

 

Can you provide us a preprocess file (literals.i), your command line options and the compiler version?

Thanks,

Viet 

0 Kudos
Wiener__Rafi
Beginner
1,003 Views

Hi,

i have no idea what is the literals.i file

this is how to reproduce

  • clone fmtlib

git clone https://github.com/fmtlib/fmt

  • checkout the commit before the fix

cd fmt

git checkout c684349195c1

build

build with icc v15-17

mkdir build

cd build

cmake .. -DCMAKE_CXX_COMPILER=icpc -DCMAKE_CC_COMPILER=icc

make

i saw the issue with 

Intel 15.0.1.20141023

Rafi

0 Kudos
Viet_H_Intel
Moderator
1,003 Views

Hi Rafi,

15.0.1 compiler is too old. 

You look into your command line options, then replace -c with -E, save the output to literals.i file and provide it to us if you still see the problem with ICC 18.0.

Thanks,

Viet

 

0 Kudos
Wiener__Rafi
Beginner
1,003 Views

I still see it with ICC17

good enough?

0 Kudos
Viet_H_Intel
Moderator
1,003 Views

 

Yes, please provide us a preprocess file.

0 Kudos
Wiener__Rafi
Beginner
1,003 Views

Hi,
This is the error i get with icc 17.0.1. same code compiles with gcc 4.8.5 and clang.
literals file attached
thanks

[ 69%] Building CXX object test/CMakeFiles/printf-test.dir/printf-test.cc.o
cd /git/fmt/build/test && /hpc/local/commercial/ics-2017-u1/compilers_and_libraries_2017.1.132/linux/bin/intel64/icpc  -DFMT_USE_ENUM_BASE=1 -DFMT_USE_FILE_DESCRIPTORS=1 -DFMT_USE_TYPE_TRAITS=1 -DGTEST_HAS_STD_WSTRING=1 -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING=0 -isystem /git/fmt/test/gtest -isystem /git/fmt/test/gmock -isystem /git/fmt/test/. -I/git/fmt/include  -O3 -DNDEBUG   -fno-delete-null-pointer-checks -std=gnu++11 -o CMakeFiles/printf-test.dir/printf-test.cc.o -c /git/fmt/test/printf-test.cc
/git/fmt/include/fmt/core.h(574): error: no instance of function template "fmt::v5::printf_formatter<T>::format [with T=TestString]" matches the argument list
            argument types are: (const TestString, fmt::v5::basic_printf_context<std::back_insert_iterator<fmt::v5::internal::basic_buffer<char>>, char, fmt::v5::printf_arg_formatter<fmt::v5::back_insert_range<fmt::v5::internal::buffer>>>)
            object type is: fmt::v5::printf_formatter<TestString>
      ctx.advance_to(f.format(*static_cast<const T*>(arg), ctx));
                       ^
/git/fmt/include/fmt/printf.h(331): note: this candidate was rejected because at least one template argument could not be deduced
    auto format(const T &value, FormatContext &ctx) -> decltype(ctx.out()) {
         ^
          detected during:
            instantiation of "void fmt::v5::internal::value<Context>::format_custom_arg<T>(const void *, Context &) [with Context=fmt::v5::basic_printf_context<std::back_insert_iterator<fmt::v5::internal::basic_buffer<char>>, char, fmt::v5::printf_arg_formatter<fmt::v5::back_insert_range<fmt::v5::internal::buffer>>>, T=TestString]" at line 557
            instantiation of "fmt::v5::internal::value<Context>::value(const T &) [with Context=fmt::v5::basic_printf_context<std::back_insert_iterator<fmt::v5::internal::basic_buffer<char>>, char, fmt::v5::printf_arg_formatter<fmt::v5::back_insert_range<fmt::v5::internal::buffer>>>, T=TestString]" at line 583
            instantiation of "fmt::v5::internal::typed_value<Context, TYPE>::typed_value(const T &) [with Context=fmt::v5::basic_printf_context<std::back_insert_iterator<fmt::v5::internal::basic_buffer<char>>, char, fmt::v5::printf_arg_formatter<fmt::v5::back_insert_range<fmt::v5::internal::buffer>>>, TYPE=fmt::v5::internal::custom_type, T=TestString]" at line 691
            instantiation of "std::enable_if<<expression>, fmt::v5::internal::typed_value<C, fmt::v5::internal::custom_type>>::type fmt::v5::internal::make_value<C,T,Char>(const T &) [with C=fmt::v5::basic_printf_context<std::back_insert_iterator<fmt::v5::internal::basic_buffer<char>>, char, fmt::v5::printf_arg_formatter<fmt::v5::back_insert_range<fmt::v5::internal::buffer>>>, T=TestString, Char=char]" at line 989
            instantiation of "std::enable_if<IS_PACKED, fmt::v5::internal::value<Context>>::type fmt::v5::internal::make_arg<IS_PACKED,Context,T>(const T &) [with IS_PACKED=true, Context=fmt::v5::basic_printf_context<std::back_insert_iterator<fmt::v5::internal::basic_buffer<char>>, char, fmt::v5::printf_arg_formatter<fmt::v5::back_insert_range<fmt::v5::internal::buffer>>>, T=TestString]" at line 1047
            instantiation of "fmt::v5::format_arg_store<Context, Args...>::format_arg_store(const Args &...) [with Context=fmt::v5::basic_printf_context<std::back_insert_iterator<fmt::v5::internal::basic_buffer<char>>, char, fmt::v5::printf_arg_formatter<fmt::v5::back_insert_range<fmt::v5::internal::buffer>>>, Args=<TestString>]" at line 1066
            instantiation of "fmt::v5::format_arg_store<Context, Args...> fmt::v5::make_format_args<Context,Args...>(const Args &...) [with Context=fmt::v5::basic_printf_context<std::back_insert_iterator<fmt::v5::internal::basic_buffer<char>>, char, fmt::v5::printf_arg_formatter<fmt::v5::back_insert_range<fmt::v5::internal::buffer>>>, Args=<TestString>]" at line 604 of "/git/fmt/include/fmt/printf.h"
            instantiation of "std::string fmt::v5::sprintf(fmt::v5::string_view, const Args &...) [with Args=<TestString>]" at line 493 of "/git/fmt/test/printf-test.cc"

compilation aborted for /git/fmt/test/printf-test.cc (code 2)
make[2]: *** [test/CMakeFiles/printf-test.dir/printf-test.cc.o] Error 2
make[2]: Leaving directory `/.autodirect/mtrswgwork/rafiw/git/fmt/build'
make[1]: *** [test/CMakeFiles/printf-test.dir/all] Error 2
make[1]: Leaving directory `/.

 

0 Kudos
Viet_H_Intel
Moderator
1,003 Views

Thanks for the .i file. I'll look into it and get back to you.

Viet

0 Kudos
Viet_H_Intel
Moderator
1,003 Views

I've reported this to our developer. The tracker is CMPLRS-51956.

Thanks,

Viet 

0 Kudos
Viet_H_Intel
Moderator
1,003 Views

 

To Workaround: Change the derivation of internal::context_base inside basic_context to public instead of private.

 

Thanks,

Viet

0 Kudos
Reply