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

Farid Zaripov reassigned STDCXX-666:
------------------------------------

    Assignee: Farid Zaripov

> [MSVC 8-x64] 21.string.cons.cpp test fails in optimized builds due to bad 
> codegeneration by the compiler
> --------------------------------------------------------------------------------------------------------
>
>                 Key: STDCXX-666
>                 URL: https://issues.apache.org/jira/browse/STDCXX-666
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Tests
>    Affects Versions: 4.2.0
>         Environment: MSVC 8.0-x64, builds 8{d|s}, 12{d|s}
>            Reporter: Farid Zaripov
>            Assignee: Farid Zaripov
>             Fix For: 4.2.1
>
>
> The 21.string.cons.cpp test fails with 16 assertions on 64-bit MSVC in 
> optimized builds.
> The reason is the bad codegeneration in __rw_new_capacity() inlined in 
> std::basic_string ctors. Because of this bug the __rw_new_capacity(0, const 
> std::basic_string<> *) returns value greater that size_max() and ctor throws 
> exception.
> The temporary workaround might be definition of the __rw_new_capacity() as 
> __declspec (noinline).
> ------------------------------
> Index: include/string
> ===================================================================
> --- include/string    (revision 593511)
> +++ include/string    (working copy)
> @@ -1528,8 +1528,13 @@
>  // more specialized version for basic_string<>; may be further specialized  
> // in user code for example on a user-defined allocator
>  
> +#if !defined (_WIN64) || !defined (_MSC_VER) || defined
> (__INTEL_COMPILER)
>  template <class _CharT, class _Traits, class _Allocator>  inline 
> _RWSTD_STRING_SIZE_TYPE
> +#else    // _WIN64 && _MSC_VER && !__INTEL_COMPILER
> +template <class _CharT, class _Traits, class _Allocator> __declspec 
> +(noinline) _RWSTD_STRING_SIZE_TYPE
> +#endif   // !_WIN64 || !_MSC_VER || __INTEL_COMPILER
>  __rw_new_capacity (_RWSTD_STRING_SIZE_TYPE __size,
>                     const _STD::basic_string<_CharT, _Traits,
> _Allocator>*)
>  {
> ------------------------------

-- 
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