Boost logo

Boost :

Subject: [boost] [any] Infinite loop in boost::any in boost release 1.54.0 using Visual C++ 2010
From: Bo Peng (elapsing_at_[hidden])
Date: 2013-10-08 01:03:32


This very simple code:

#include <boost/any.hpp>
#include <string>

const boost::any getBoolVal()
{
    return false;
}

int main()
{
    boost::any vals[] = {1.0, std::string("1m"), getBoolVal()};
}

When built using Visual C++ 2010, it will run into a infinite loop:
  ntdll.dll!_RtlAllocateHeap_at_12() + 0x8 bytes
  ntdll.dll!_RtlDebugAllocateHeap_at_12() + 0x86 bytes
  ntdll.dll!@RtlpAllocateHeap_at_20() + 0x1108a bytes
  ntdll.dll!_RtlAllocateHeap_at_12() - 0x28d8a bytes
  msvcr100d.dll!_heap_alloc_base(unsigned int size=44) Line 55 C
  msvcr100d.dll!_heap_alloc_dbg_impl(unsigned int nSize=8, int nBlockUse=1,
const char * szFileName=0x00000000, int nLine=0, int *
errno_tmp=0x002a3280) Line 431 + 0x9 bytes C++
  msvcr100d.dll!_nh_malloc_dbg_impl(unsigned int nSize=8, int nhFlag=0, int
nBlockUse=1, const char * szFileName=0x00000000, int nLine=0, int *
errno_tmp=0x002a3280) Line 239 + 0x19 bytes C++
  msvcr100d.dll!_nh_malloc_dbg(unsigned int nSize=8, int nhFlag=0, int
nBlockUse=1, const char * szFileName=0x00000000, int nLine=0) Line 302 +
0x1d bytes C++
  msvcr100d.dll!malloc(unsigned int nSize=8) Line 56 + 0x15 bytes C++
  msvcr100d.dll!operator new(unsigned int size=8) Line 59 + 0x9 bytes C++
  test.exe!boost::any::any<boost::any const >(const boost::any &&
value={...}, void * __formal=0x00000000) Line 73 + 0x49 bytes C++
  test.exe!boost::any::holder<boost::any const >::holder<boost::any const
>(const boost::any && value={...}) Line 177 C++
  ...
  test.exe!boost::any::any<boost::any const >(const boost::any &&
value={...}, void * __formal=0x00000000) Line 73 + 0x71 bytes C++
  test.exe!boost::any::holder<boost::any const >::holder<boost::any const
>(const boost::any && value={...}) Line 177 C++
  test.exe!boost::any::any<boost::any const >(const boost::any &&
value={...}, void * __formal=0x00000000) Line 73 + 0x71 bytes C++
  test.exe!boost::any::holder<boost::any const >::holder<boost::any const
>(const boost::any && value={...}) Line 177 C++
  test.exe!boost::any::any<boost::any const >(const boost::any &&
value={...}, void * __formal=0x00000000) Line 73 + 0x71 bytes C++
  test.exe!boost::any::holder<boost::any const >::holder<boost::any const
>(const boost::any && value={...}) Line 177 C++
> test.exe!boost::any::any<boost::any const >(const boost::any &&
value={...}, void * __formal=0x00000000) Line 73 + 0x71 bytes C++
  test.exe!main() Line 11 + 0x9c bytes C++

Sorry I don't know enough of the c++ standard to figure out whether it is
because of Visual C++ or it is because of boost. But I think it is worth to
raise it to the experts out here.

Thanks
Bo

----
http://www.pengbo.me

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk