[ 
https://issues.apache.org/jira/browse/QPID-1458?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Cliff Jansen updated QPID-1458:
-------------------------------

    Attachment: QPID-1458.diff

This bug arises because the InlineAllocator trades standards
conformance for improved performance.  The Windows stl library
exercises the allocator in a new way.

  InlineAllocator(T1)::rebind(T2)::other

fails when T1 differs from T2.  In use, the Linux code (including the
stl implementation) only calls rebind with T2 the same type as T1.

The Microsoft template library has built in features for checked
iterators (bounds checking and the like).  This is turned on by
default.

A Visual C++ bug fix between VC8 and VC9 introduced memory allocation
for a separate object, std::_Aux_cont, which triggers the error.  This
is only needed in release mode since the debug mode has a separate
mechanism.

One possible solution is to turn off the iterator checking code

  /D_SECURE_SCL=0

The downside to this approach, is that all third party libraries must
be compiled the same way, otherwise obscure memory corruption can
occur.  In particular, since Boost is built /D_SECURE_SCL=1, qpid
users on Windows would have to use a custom built Boost.

Another approach is to change the "rebind" to act as it currently does
on an identity mapping (leaving the actual rebind unchanged on Linux),
but switch to the non-inline BaseAllocator otherwise.  In any event,
the chosen "Max" attribute is closely associated with the original
instantiation of the InlineVector's value type.  It is not clear in
what circumstances the "Max" attribute would sensibly transfer to an
arbitrary other value type.

See the attached proposed patch to InlineAllocator.h


> C++ common compile error in VC9 Release mode
> --------------------------------------------
>
>                 Key: QPID-1458
>                 URL: https://issues.apache.org/jira/browse/QPID-1458
>             Project: Qpid
>          Issue Type: Bug
>          Components: C++ Broker, C++ Client
>    Affects Versions: M4
>         Environment: Windows, Visual Studio 2008 (VC9)
>            Reporter: Steve Huston
>         Attachments: QPID-1458.diff
>
>
> When building C++ common library in Release mode, the following compile 
> errors appear:
> 1>C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\xutility(419) 
> : error C2664: 
> 'qpid::InlineAllocator<BaseAllocator,Max>::InlineAllocator(const 
> qpid::InlineAllocator<BaseAllocator,Max> &)' : cannot convert parameter 1 
> from 'qpid::InlineAllocator<BaseAllocator,Max>' to 'const 
> qpid::InlineAllocator<BaseAllocator,Max> &'
> 1>        with
> 1>        [
> 1>            BaseAllocator=std::allocator<std::_Aux_cont>,
> 1>            Max=3
> 1>        ]
> 1>        and
> 1>        [
> 1>            
> BaseAllocator=std::allocator<qpid::Range<qpid::framing::SequenceNumber>>,
> 1>            Max=3
> 1>        ]
> 1>        and
> 1>        [
> 1>            BaseAllocator=std::allocator<std::_Aux_cont>,
> 1>            Max=3
> 1>        ]
> 1>        Reason: cannot convert from 
> 'qpid::InlineAllocator<BaseAllocator,Max>' to 'const 
> qpid::InlineAllocator<BaseAllocator,Max>'
> 1>        with
> 1>        [
> 1>            
> BaseAllocator=std::allocator<qpid::Range<qpid::framing::SequenceNumber>>,
> 1>            Max=3
> 1>        ]
> 1>        and
> 1>        [
> 1>            BaseAllocator=std::allocator<std::_Aux_cont>,
> 1>            Max=3
> 1>        ]
> 1>        No user-defined-conversion operator available that can perform this 
> conversion, or the operator cannot be called
> 1>        C:\Program Files (x86)\Microsoft Visual Studio 
> 9.0\VC\include\xutility(417) : while compiling class template member function 
> 'std::_Container_base_aux_alloc_real<_Alloc>::_Container_base_aux_alloc_real(_Alloc)'
> 1>        with
> 1>        [
> 1>            
> _Alloc=qpid::InlineAllocator<std::allocator<qpid::Range<qpid::framing::SequenceNumber>>,3>
> 1>        ]
> 1>        C:\Program Files (x86)\Microsoft Visual Studio 
> 9.0\VC\include\vector(421) : see reference to class template instantiation 
> 'std::_Container_base_aux_alloc_real<_Alloc>' being compiled
> 1>        with
> 1>        [
> 1>            
> _Alloc=qpid::InlineAllocator<std::allocator<qpid::Range<qpid::framing::SequenceNumber>>,3>
> 1>        ]
> 1>        C:\Program Files (x86)\Microsoft Visual Studio 
> 9.0\VC\include\vector(439) : see reference to class template instantiation 
> 'std::_Vector_val<_Ty,_Alloc>' being compiled
> 1>        with
> 1>        [
> 1>            _Ty=qpid::Range<qpid::framing::SequenceNumber>,
> 1>            
> _Alloc=qpid::InlineAllocator<std::allocator<qpid::Range<qpid::framing::SequenceNumber>>,3>
> 1>        ]
> 1>        .\qpid/InlineVector.h(42) : see reference to class template 
> instantiation 'std::vector<_Ty,_Ax>' being compiled
> 1>        with
> 1>        [
> 1>            _Ty=qpid::Range<qpid::framing::SequenceNumber>,
> 1>            
> _Ax=qpid::InlineAllocator<std::allocator<qpid::Range<qpid::framing::SequenceNumber>>,3>
> 1>        ]
> 1>        .\qpid/RangeSet.h(168) : see reference to class template 
> instantiation 'qpid::InlineVector<T,Max>' being compiled
> 1>        with
> 1>        [
> 1>            T=qpid::Range<qpid::framing::SequenceNumber>,
> 1>            Max=3
> 1>        ]
> 1>        
> c:\ace\exported\qpid\trunk\qpid\cpp\src\qpid\framing\SequenceSet.h(31) : see 
> reference to class template instantiation 'qpid::RangeSet<T>' being compiled
> 1>        with
> 1>        [
> 1>            T=qpid::framing::SequenceNumber
> 1>        ]
> This problem does not occur with VC8, nor with VC9 in Debug mode.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to