Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#6359 closed Bugs (fixed)

Intel Composer XE 2011 (12.0) fails to build Boost.Regex with ICU support

Reported by: Brian Bassett <bbassett@…> Owned by: John Maddock
Milestone: To Be Determined Component: regex
Version: Boost 1.48.0 Severity: Regression
Keywords: intel-win-12.0 Cc:

Description

Environment

Reproduce Steps

  1. Apply the attached patch (icubld.patch) in order to correctly have Boost.Build use the correct names for the ICU DLLs with the Intel toolset.
  1. Unpack the Win32 ICU binary distribution to a temporary directory (i.e., C:\tmp\icu).
  1. Start a command prompt with the Intel Composer XE 2011 environment (i.e., Start Menu -> All Programs -> Intel Parallel Studio XE 2011 -> Command Prompt -> Parallel Studio XE with Intel Compiler XE v12.1 Update 2 -> IA-32 Visual Studio 2010 mode)
  1. Change directory into the Boost source tree and run:
b2 --build-type=complete toolset=intel-12.0 address-model=32 -sICU_PATH=C:\tmp\icu stage
  1. Observe that building libs/regex/src/icu.cpp fails with the following error:
.\boost/type_traits/is_convertible.hpp(264): error: a reference of type "const boost::icu_regex_traits::char_type={UChar32={int32_t={signed int}}} *&" (not const-qualified) cannot be initialized with a value of type "ptrdiff_t={int} *"
      BOOST_STATIC_CONSTANT(bool, value =
      ^
          detected during:
            instantiation of class "boost::detail::is_convertible_basic_impl<From, To> [with From=ptrdiff_t={int} *&, To=const boost::icu_regex_traits::char_type={UChar32={int32_t={signed int}}} *&]" at line 296
            instantiation of class "boost::detail::is_convertible_impl<From, To> [with From=ptrdiff_t={int} *, To=const boost::icu_regex_traits::char_type={UChar32={int32_t={signed int}}} *&]" at line 372
            instantiation of class "boost::detail::is_convertible_impl_dispatch<From, To> [with From=ptrdiff_t={int} *, To=const boost::icu_regex_traits::char_type={UChar32={int32_t={signed int}}} *&]" at line 419
            instantiation of class "boost::is_convertible<From, To> [with From=ptrdiff_t={int} *, To=const boost::icu_regex_traits::char_type={UChar32={int32_t={signed int}}} *&]" at line 183 of ".\boost/regex/v4/regex_format.hpp"
            instantiation of "int boost::re_detail::basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::toi(ForwardIter &, ForwardIter, int) [with OutputIterator=boost::utf16_output_iterator<boost::re_detail::unicode_string_out_iterator>, Results=boost::match_results<boost::u16_to_u32_iterator<const UChar={__wchar_t} *, unsigned int>, std::allocator<boost::sub_match<boost::u16_to_u32_iterator<const UChar={__wchar_t} *, unsigned int>>>>,
                      traits=boost::regex_traits_wrapper<boost::icu_regex_traits>, ForwardIter=ptrdiff_t={int} *]" at line 543 of ".\boost/regex/v4/regex_format.hpp"
            instantiation of "void boost::re_detail::basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format_escape() [with OutputIterator=boost::utf16_output_iterator<boost::re_detail::unicode_string_out_iterator>, Results=boost::match_results<boost::u16_to_u32_iterator<const UChar={__wchar_t} *, unsigned int>, std::allocator<boost::sub_match<boost::u16_to_u32_iterator<const UChar={__wchar_t} *, unsigned int>>>>, traits=boost::regex_traits_wrapper<boost::icu_regex_traits>,
                      ForwardIter=ptrdiff_t={int} *]" at line 229 of ".\boost/regex/v4/regex_format.hpp"
            instantiation of "void boost::re_detail::basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format_all() [with OutputIterator=boost::utf16_output_iterator<boost::re_detail::unicode_string_out_iterator>, Results=boost::match_results<boost::u16_to_u32_iterator<const UChar={__wchar_t} *, unsigned int>, std::allocator<boost::sub_match<boost::u16_to_u32_iterator<const UChar={__wchar_t} *, unsigned int>>>>, traits=boost::regex_traits_wrapper<boost::icu_regex_traits>,
                      ForwardIter=ptrdiff_t={int} *]" at line 207 of ".\boost/regex/v4/regex_format.hpp"
            instantiation of "OutputIterator boost::re_detail::basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format(ForwardIter, ForwardIter, boost::regex_constants::match_flag_type={boost::regex_constants::match_flags={boost::regex_constants::_match_flags}}) [with OutputIterator=boost::utf16_output_iterator<boost::re_detail::unicode_string_out_iterator>, Results=boost::match_results<boost::u16_to_u32_iterator<const UChar={__wchar_t} *, unsigned int>,
                      std::allocator<boost::sub_match<boost::u16_to_u32_iterator<const UChar={__wchar_t} *, unsigned int>>>>, traits=boost::regex_traits_wrapper<boost::icu_regex_traits>, ForwardIter=ptrdiff_t={int} *]" at line 838 of ".\boost/regex/v4/regex_format.hpp"
            instantiation of "OutputIterator boost::re_detail::regex_format_imp(OutputIterator, const boost::match_results<Iterator, Alloc> &, ForwardIter, ForwardIter, boost::regex_constants::match_flag_type={boost::regex_constants::match_flags={boost::regex_constants::_match_flags}}, const traits &) [with OutputIterator=boost::utf16_output_iterator<boost::re_detail::unicode_string_out_iterator>, Iterator=boost::u16_to_u32_iterator<const UChar={__wchar_t} *, unsigned int>,
                      Alloc=std::allocator<boost::sub_match<boost::u16_to_u32_iterator<const UChar={__wchar_t} *, unsigned int>>>, ForwardIter=ptrdiff_t={int} *, traits=boost::regex_traits_wrapper<boost::icu_regex_traits>]" at line 851 of ".\boost/regex/icu.hpp"
            instantiation of "OutputIterator boost::re_detail::do_regex_replace(OutputIterator, const std::pair<I1, I1> &, const boost::u32regex &, const std::pair<I2, I2> &, boost::regex_constants::match_flag_type={boost::regex_constants::match_flags={boost::regex_constants::_match_flags}}) [with OutputIterator=boost::utf16_output_iterator<boost::re_detail::unicode_string_out_iterator>, I1=boost::u16_to_u32_iterator<const UChar={__wchar_t} *, unsigned int>, I2=boost::u16_to_u32_iterator<const
                      UChar={__wchar_t} *, unsigned int>]" at line 1013 of ".\boost/regex/icu.hpp"

.\boost/regex/v4/regex_format.hpp(179): error: a reference of type "const boost::icu_regex_traits::char_type={UChar32={int32_t={signed int}}} *&" (not const-qualified) cannot be initialized with a value of type "ptrdiff_t={int} *"
        return m_traits.toi(i, j, base);
                            ^
          detected during:
            instantiation of "int boost::re_detail::basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::toi(ForwardIter &, ForwardIter, int, const boost::mpl::true_ &) [with OutputIterator=boost::utf16_output_iterator<boost::re_detail::unicode_string_out_iterator>, Results=boost::match_results<boost::u16_to_u32_iterator<const UChar={__wchar_t} *, unsigned int>, std::allocator<boost::sub_match<boost::u16_to_u32_iterator<const UChar={__wchar_t} *, unsigned int>>>>,
                      traits=boost::regex_traits_wrapper<boost::icu_regex_traits>, ForwardIter=ptrdiff_t={int} *]" at line 184
            instantiation of "int boost::re_detail::basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::toi(ForwardIter &, ForwardIter, int) [with OutputIterator=boost::utf16_output_iterator<boost::re_detail::unicode_string_out_iterator>, Results=boost::match_results<boost::u16_to_u32_iterator<const UChar={__wchar_t} *, unsigned int>, std::allocator<boost::sub_match<boost::u16_to_u32_iterator<const UChar={__wchar_t} *, unsigned int>>>>,
                      traits=boost::regex_traits_wrapper<boost::icu_regex_traits>, ForwardIter=ptrdiff_t={int} *]" at line 543
            instantiation of "void boost::re_detail::basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format_escape() [with OutputIterator=boost::utf16_output_iterator<boost::re_detail::unicode_string_out_iterator>, Results=boost::match_results<boost::u16_to_u32_iterator<const UChar={__wchar_t} *, unsigned int>, std::allocator<boost::sub_match<boost::u16_to_u32_iterator<const UChar={__wchar_t} *, unsigned int>>>>, traits=boost::regex_traits_wrapper<boost::icu_regex_traits>,
                      ForwardIter=ptrdiff_t={int} *]" at line 229
            instantiation of "void boost::re_detail::basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format_all() [with OutputIterator=boost::utf16_output_iterator<boost::re_detail::unicode_string_out_iterator>, Results=boost::match_results<boost::u16_to_u32_iterator<const UChar={__wchar_t} *, unsigned int>, std::allocator<boost::sub_match<boost::u16_to_u32_iterator<const UChar={__wchar_t} *, unsigned int>>>>, traits=boost::regex_traits_wrapper<boost::icu_regex_traits>,
                      ForwardIter=ptrdiff_t={int} *]" at line 207
            instantiation of "OutputIterator boost::re_detail::basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format(ForwardIter, ForwardIter, boost::regex_constants::match_flag_type={boost::regex_constants::match_flags={boost::regex_constants::_match_flags}}) [with OutputIterator=boost::utf16_output_iterator<boost::re_detail::unicode_string_out_iterator>, Results=boost::match_results<boost::u16_to_u32_iterator<const UChar={__wchar_t} *, unsigned int>,
                      std::allocator<boost::sub_match<boost::u16_to_u32_iterator<const UChar={__wchar_t} *, unsigned int>>>>, traits=boost::regex_traits_wrapper<boost::icu_regex_traits>, ForwardIter=ptrdiff_t={int} *]" at line 838
            instantiation of "OutputIterator boost::re_detail::regex_format_imp(OutputIterator, const boost::match_results<Iterator, Alloc> &, ForwardIter, ForwardIter, boost::regex_constants::match_flag_type={boost::regex_constants::match_flags={boost::regex_constants::_match_flags}}, const traits &) [with OutputIterator=boost::utf16_output_iterator<boost::re_detail::unicode_string_out_iterator>, Iterator=boost::u16_to_u32_iterator<const UChar={__wchar_t} *, unsigned int>,
                      Alloc=std::allocator<boost::sub_match<boost::u16_to_u32_iterator<const UChar={__wchar_t} *, unsigned int>>>, ForwardIter=ptrdiff_t={int} *, traits=boost::regex_traits_wrapper<boost::icu_regex_traits>]" at line 851 of ".\boost/regex/icu.hpp"
            instantiation of "OutputIterator boost::re_detail::do_regex_replace(OutputIterator, const std::pair<I1, I1> &, const boost::u32regex &, const std::pair<I2, I2> &, boost::regex_constants::match_flag_type={boost::regex_constants::match_flags={boost::regex_constants::_match_flags}}) [with OutputIterator=boost::utf16_output_iterator<boost::re_detail::unicode_string_out_iterator>, I1=boost::u16_to_u32_iterator<const UChar={__wchar_t} *, unsigned int>, I2=boost::u16_to_u32_iterator<const
                      UChar={__wchar_t} *, unsigned int>]" at line 1013 of ".\boost/regex/icu.hpp"

compilation aborted for libs\regex\build\..\src\icu.cpp (code 2)

Note that I've ommitted the remarks and warnings output by icl for clarity.

Additional Comments

Note that I've had no problems building this file on Linux using the same version of Intel's Linux compiler (2011.8.273), nor with earlier versions (11.1) of Intel's Windows compiler. This compiler (intel-win-12.0) is the only one I can trigger this compilation error. As such, I suspect this is actually a compiler bug with Intel. If it turns out to be such, please let me know and I can follow up with Intel directly.

Attachments (1)

icubld.diff (1.8 KB ) - added by Brian Bassett <bbassett@…> 11 years ago.
Patch to have intel-win toolset use the correct ICU library names

Download all attachments as: .zip

Change History (7)

by Brian Bassett <bbassett@…>, 11 years ago

Attachment: icubld.diff added

Patch to have intel-win toolset use the correct ICU library names

comment:1 by John Maddock, 11 years ago

Confirmed.

Reduced test case is just:

void test(...);
void test(const int*&);


int main()
{
   int * p = 0;
   test(p);
}

Reported to Intel as support issue #656654.

A workaround is:

Index: regex_format.hpp
===================================================================
--- regex_format.hpp	(revision 76120)
+++ regex_format.hpp	(working copy)
@@ -180,8 +180,14 @@
    }
    inline int toi(ForwardIter& i, ForwardIter j, int base)
    {
+#if defined(_MSC_VER) && defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 9999)
+      // Workaround for Intel support issue #656654.
+      // See also https://svn.boost.org/trac/boost/ticket/6359
+      return toi(i, j, base, mpl::false_());
+#else
       typedef typename boost::is_convertible<ForwardIter, const char_type*&>::type tag_type;
       return toi(i, j, base, tag_type());
+#endif
    }
 
    const traits&    m_traits;       // the traits class for localised formatting operations

HTH, John.

comment:2 by John Maddock, 11 years ago

Resolution: fixed
Status: newclosed

(In [76319]) Add workaround for Intel-12.1 on Windows. Fixes #6359.

comment:3 by John Maddock, 11 years ago

PS Forgot to add that your patch will break ICU build on Intel-Linux. I haven't been able to get a version to work that selects "intel-win" as the toolset :-(

comment:4 by Brian Bassett <bbassett@…>, 11 years ago

That's OK...the patch was designed to facilitate demonstrating the issue, and not actually intended to be used in production. (We're actually using Boost.CMake to build our copies of Boost libraries, so we have other ways to get the right library names linked in.)

However, I had to make a tweak to your workaround. The ifdef had to be:

#if defined(_MSC_VER) && defined(__INTEL_COMPILER) && ((__INTEL_COMPILER == 9999) || (__INTEL_COMPILER == 1210))

since Composer XE 2011 Update 8 has gotten the correct value of __INTEL_COMPILER.

comment:5 by John Maddock, 11 years ago

(In [76324]) Fix pp-logic. Refs #6359.

comment:6 by John Maddock, 11 years ago

Dang.... your updated patch has been applied, also found a way to fix Boost.Build to look for the correct ICU libs...

John.

Note: See TracTickets for help on using tickets.