Open stefan-floeren opened 6 years ago
hmm, i don't have an msvc2015 32bit devenv at hand atm, but could you test:
diff --git a/include/boost/lockfree/detail/freelist.hpp b/include/boost/lockfree/detail/freelist.hpp
index 374b0c7..266a0a6 100644
--- a/include/boost/lockfree/detail/freelist.hpp
+++ b/include/boost/lockfree/detail/freelist.hpp
@@ -38,6 +38,7 @@ namespace detail {
template <typename T,
typename Alloc = std::allocator<T>
>
+BOOST_ALIGNMENT( 8 )
class freelist_stack:
Alloc
{
diff --git a/include/boost/lockfree/stack.hpp b/include/boost/lockfree/stack.hpp
index b9e43df..3efcfc4 100644
--- a/include/boost/lockfree/stack.hpp
+++ b/include/boost/lockfree/stack.hpp
@@ -66,6 +66,7 @@ template <typename T, class A0, class A1, class A2>
#else
template <typename T, typename ...Options>
#endif
+BOOST_ALIGNMENT( 8 )
class stack
{
private:
?
The same error (out.log).
Note that I used the following patch, consistent with the other uses of BOOST_ALIGNMENT
, as I get an INTERNAL COMPILER ERROR
with your patch.
diff --git a/include/boost/lockfree/detail/freelist.hpp b/include/boost/lockfree/detail/freelist.hpp
index 374b0c7..77fe14d 100644
--- a/include/boost/lockfree/detail/freelist.hpp
+++ b/include/boost/lockfree/detail/freelist.hpp
@@ -38,7 +38,9 @@ namespace detail {
template <typename T,
typename Alloc = std::allocator<T>
>
-class freelist_stack:
+class
+BOOST_ALIGNMENT( 8 )
+ freelist_stack:
Alloc
{
struct freelist_node
diff --git a/include/boost/lockfree/stack.hpp b/include/boost/lockfree/stack.hpp
index b9e43df..3de124d 100644
--- a/include/boost/lockfree/stack.hpp
+++ b/include/boost/lockfree/stack.hpp
@@ -66,7 +66,9 @@ template <typename T, class A0, class A1, class A2>
#else
template <typename T, typename ...Options>
#endif
-class stack
+class
+BOOST_ALIGNMENT( 8 )
+ stack
{
private:
#ifndef BOOST_DOXYGEN_INVOKED
I've got the same problems with msvc 2015 x86. The problem is that msvc 2015 x86 doesn't support alignment of 8 for function parameters passed on the stack. (AFAIK they're only guaranteed to be aligned at 4-bytes and there's no way to specify parameter-alignment.)
hmm, i've tested msvc 2017 ia32, which builds fine :/
I can also confirm that msvc 2017 x86 (and of course also x64) supports alignment for function parameters. But msvc 2015 has issues:
IMHO removing the alignment request for msvc <= 2015 (x86) would be the best.
Just to be complete. msvc 2017 supports alignment for function parameter up to alignas(64) for both x86 and x64.
i've fixed a few issues of aligned function parameters, but i cannot see in the error message, which function fails to instantiate due to parameter alignment :/
removing alignment hints is not an option here, as it's std::atomic
, that is aligned.
but does it help to force the use of boost.atomic?
Yes, switching to boost.atomic (and adding boost namespace to all the memoryorder... solves the problem! The reason is: in std::atomic, atomic::atomic(_Ty _Val) and atomic::operator=(_Ty _Right) takes its argument by value, while boost.atomic takes args > sizeof(void*) by const-ref!
We had this problem as well using boost::lockfree::queue
.
As @tobias-loew did, we've added #define BOOST_LOCKFREE_FORCE_BOOST_ATOMIC
before the include fixes the compiler error for us. Then undef'ing at the end of the header.
Are there any hidden caveats to doing that?
Thanks
I found this problem in vs2013, the really reason maybe in files:prefix.hpp and tagged_ptr_ptrcompression.hpp the macro defined in boost 1.67: it is: #ifdef BOOST_ARCH_X86_64 but in boost 1.68 it is:#if BOOST_ARCH_X86_64 || defined (aarch64)
we can change to #if defined(BOOST_ARCH_X86_64) || defined (aarch64) before the include fixes the compiler error for us
Hi,
After upgrading to Boost 1.68.0, builds using lockfree fail on x86; x64 works.
Compiler version:
On trying to compile the test cases, I get this error (complete log attached):
Could you please have a look on how to fix this issue?
Complete log