Boost format library Segmentation fault with Intel 8.1
Hi! I get a segmentation fault with Intel compiler 8.1 using the fallowing code #include <boost/format.hpp> #include <iostream> int main() { std::cout << boost::format("writing %1%, x=%2% : %3%-th try") % "toto" % 40.23 % 50 << std::endl; return 0; } (idb) bt #0 0x0804aba8 in ctype<char>::is (this=0x41016b50, __m=2048, __c=49 '1') at ctype_inline.h:40 #1 0x08051d55 in std::isdigit (__c=49 '1', __loc=& { ... }) at locale_facets.h:4528 #2 0x0805517f in boost::io::detail::wrap_isdigit (c=49 '1', os=& { ... }) at parsing.hpp:36 #3 0x0805509b in boost::io::detail::wrap_scan_notdigit (beg= { ... }, end= { ... }, os=& { ... }) at parsing.hpp:46 #4 0x08054f7b in boost::io::detail::upper_bound_from_fstring (buf=& { ... }, arg_mark=37 '%', os=& { ... }, exceptions=-1 '\377') at parsing.hpp:351 #5 0x0804d33a in basic_format<char,std::char_traits<char> >::parse (this=0xbffff480, buf=& { ... }) at parsing.hpp:377 #6 0x0804ceab in basic_format<char,std::char_traits<char> >::basic_format (this=0xbffff480, str=0x80572a8 "writing %1%, x=%2% : %3%-th try") at format_implementation.hpp:37 #7 0x0804d02c in basic_format<char,std::char_traits<char> >::basic_format (this=0xbffff480, =<no value>) at format_implementation.hpp:38 #8 0x0804a41c in main () at test.cc:5 #9 0x4102e7f8 The same code works perfectly with gcc-3.4.2 under linux. Is this a bug in boost format library or a Intel compiler problem? My system: Debian, boost-1.31.0, gcc-3.4.2, Intel compiler 8.1 -- Filipe Sousa
Filipe Sousa wrote:
Hi!
I get a segmentation fault with Intel compiler 8.1 using the fallowing code
#include <boost/format.hpp> #include <iostream>
int main() { std::cout << boost::format("writing %1%, x=%2% : %3%-th try") % "toto" % 40.23 % 50 << std::endl; return 0; }
(idb) bt #0 0x0804aba8 in ctype<char>::is (this=0x41016b50, __m=2048, __c=49 '1') #at ctype_inline.h:40 #1 0x08051d55 in std::isdigit (__c=49 '1', __loc=& { ... }) at
The same code works perfectly with gcc-3.4.2 under linux. Is this a bug in boost format library or a Intel compiler problem?
The segfault takes place inside the compiler's standard library functions, so it seems like the bug is in icc. Segfaulting inside isdigit is not a conformant behaviour :) Though, that might be the result of a binary link problem, or a strange thing going on. Did you try calling std::isdigit directly, on facets constructed the way format constructs them ? the facet object is coming from those lines : #if !defined(BOOST_NO_STD_LOCALE) const std::ctype<Ch> & fac = BOOST_USE_FACET( std::ctype<Ch>, getloc()); #else io::basic_oaltstringstream<Ch, Tr, Alloc> fac; //has widen and narrow even on compilers without locale #endif (so 'fac' is in fact a stream, in case the compiler doesnt support locales. this way the workarounds needed minimal extra code.. But anyway I think icc has locales, and fac is constructed with BOOST_USE_FACET ) It might also be caused by the rest of the code fiddling some memory areas. (is this line of code causing the same bug when nothing else is executed ?) -- Samuel
participants (2)
-
Filipe Sousa
-
Samuel Krempp