[regex] broken match_results functions for Intel 8.0

After upgrading to Boost 1.33.0 I found a problem with my code when built for Intel 8.0 on Linux. The problem doesn't show up with g++. I reduced it to a simple test case. With Intel 8.0 it compiles but fails to link the executable, complaining that it can't find the 'position' and 'str' functions. Note that it does find the 'length' function. I built the library with these options, and there were no errors: bjam -sTOOLS=intel-linux -sINTEL_PATH=/usr/local/intel/compiler80/ia32 --with-python-root=/usr --without-iostreams --without-python --without-serialization --stagedir=stage -sBUILD="debug release <threading>single" stage This copy of the console log documents the test case, working with g++ and failing to link with icpc: % cat RegexIntelLinuxBug.cc #include <iostream> #include <boost/regex.hpp> int main (int argc, const char * const *argv) { static const boost::regex pat ("[[:alpha:]]+"); const char str[] = "xyzzy"; boost::cmatch what; if (! boost::regex_search (str, what, pat)) std::cout << "not found" << std::endl; else { std::cout << "found '" << what.str () << "': " << what.length () << " characters at position " << what.position () << std::endl; } return 0; } % g++ -I/u/hadsell/cgi/Include/libboost -c -o RegexIntelLinuxBug.o RegexIntelLinuxBug.cc % g++ -o RegexIntelLinuxBug RegexIntelLinuxBug.o /u/hadsell/cgi/Lib/LINUX_X86FC3/libboostrgx.a % RegexIntelLinuxBug found 'xyzzy': 5 characters at position 0 % icpc -V Intel(R) C++ Compiler for 32-bit applications, Version 8.0 Build 20040304Z Package ID: l_cc_pc_8.0.058_pe061 Copyright (C) 1985-2004 Intel Corporation. All rights reserved. icpc: Command line error: no files specified; for help type "icpc -help" % icpc -I/u/hadsell/cgi/Include/libboost -c -o RegexIntelLinuxBug.o RegexIntelLinuxBug.cc % icpc -o RegexIntelLinuxBug RegexIntelLinuxBug.o /u/hadsell/cgi/Lib/LINUX_X86/libboostrgx.a RegexIntelLinuxBug.o(.text+0x1b1): In function `main': : undefined reference to `boost::match_results<char const*, std::allocator<boost::sub_match<char const*> > >::str(int) const' RegexIntelLinuxBug.o(.text+0x1fe): In function `main': : undefined reference to `boost::match_results<char const*, std::allocator<boost::sub_match<char const*> > >::position(unsigned) const' -- Dick Hadsell 914-259-6320 Fax: 914-259-6499 Reply-to: hadsell@blueskystudios.com Blue Sky Studios http://www.blueskystudios.com 44 South Broadway, White Plains, NY 10601

After upgrading to Boost 1.33.0 I found a problem with my code when built for Intel 8.0 on Linux. The problem doesn't show up with g++. I reduced it to a simple test case. With Intel 8.0 it compiles but fails to link the executable, complaining that it can't find the 'position' and 'str' functions. Note that it does find the 'length' function.
Intel(R) C++ Compiler for 32-bit applications, Version 8.0 Build 20040304Z Package ID: l_cc_pc_8.0.058_pe061 Copyright (C) 1985-2004 Intel Corporation. All rights reserved.
I can't reproduce that with Package 8.1.026 (unfortunately you can't install both 8.0 and 8.1 at the same time, so I wasn't able to test with 8.0). I have a suspicion that what's happening is this: The match_results<const char*> template instance is explicitly instantiated in the library, and declared as "extern" in user code (so it uses the instance in the library). I suspect that your code is being built with inline expansions off, but the release version of the lib doesn't have these inline members instantiated in it, so either: 1) Try linking to the debug build of the lib when building with inline expansion turned off. 2) uncomment the line // #define BOOST_REGEX_NO_EXTERNAL_TEMPLATES in boost/regex/user.hpp and rebuild everything, the regex lib will now be slightly smaller, and your exe will be a lot bigger, but it should cure the problem. 3) Upgrade to Intel 8.1, I realise this might not be possible though. HTH, John.

John Maddock wrote:
I can't reproduce that with Package 8.1.026 (unfortunately you can't install both 8.0 and 8.1 at the same time, so I wasn't able to test with 8.0).
You can install both. However, that requires some effort (fooling rpm into believing icc wasn't installed, renaming directories and adjusting the driver scripts, and, after that, installing the other version of icc). Regards, m Send instant messages to your online friends http://au.messenger.yahoo.com

You can install both. However, that requires some effort (fooling rpm into believing icc wasn't installed, renaming directories and adjusting the driver scripts, and, after that, installing the other version of icc).
Sorry, but I think I'll be loosing the will to live if I have to go through that! John.

John Maddock wrote:
I have a suspicion that what's happening is this:
The match_results<const char*> template instance is explicitly instantiated in the library, and declared as "extern" in user code (so it uses the instance in the library). I suspect that your code is being built with inline expansions off, but the release version of the lib doesn't have these inline members instantiated in it, so either:
My code is not built with inlining disabled. For compiling I use '-mp -pc64 -DBOOST_ENABLE_ASSERT_HANDLER' with the addition of '-O2 -xN -vec_report0 -DBOOST_DISABLE_ASSERTS' for optimized and '-g' for debug versions. For linking I use '-Wl,--export-dynamic'.
1) Try linking to the debug build of the lib when building with inline expansion turned off. 2) uncomment the line // #define BOOST_REGEX_NO_EXTERNAL_TEMPLATES in boost/regex/user.hpp and rebuild everything, the regex lib will now be slightly smaller, and your exe will be a lot bigger, but it should cure the problem.
I will try this.
3) Upgrade to Intel 8.1, I realise this might not be possible though.
We tried 8.1, but it produces code that is slower than g++ 3.4.4 for our application, so we are retiring the Intel version. It also has a bug that Intel only fixed in 9.0. -- Dick Hadsell 914-259-6320 Fax: 914-259-6499 Reply-to: hadsell@blueskystudios.com Blue Sky Studios http://www.blueskystudios.com 44 South Broadway, White Plains, NY 10601

Richard Hadsell wrote:
John Maddock wrote:
2) uncomment the line // #define BOOST_REGEX_NO_EXTERNAL_TEMPLATES in boost/regex/user.hpp and rebuild everything, the regex lib will now be slightly smaller, and your exe will be a lot bigger, but it should cure the problem.
I will try this.
This helped. At least, my application links successfully. I have never used BOOST_WORKAROUND myself. Would it be appropriate for me to surround the #define in user.hpp with this guard? #if BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 800 ) -- -- Dick Hadsell 914-259-6320 Fax: 914-259-6499 Reply-to: hadsell@blueskystudios.com Blue Sky Studios http://www.blueskystudios.com 44 South Broadway, White Plains, NY 10601

This helped. At least, my application links successfully.
Whew.
I have never used BOOST_WORKAROUND myself. Would it be appropriate for me to surround the #define in user.hpp with this guard?
#if BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 800 )
If you plan on using multiple compilers / versions then yes. Now that I know what the fix is, I'll update the regex lib's config to set that define automatically for Intel 8.0 and earlier. Thanks for checking this out, John.
participants (3)
-
John Maddock
-
Martin Wille
-
Richard Hadsell