Comments (9)
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:
?
from lockfree.
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
from lockfree.
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.)
from lockfree.
hmm, i've tested msvc 2017 ia32, which builds fine :/
from lockfree.
I can also confirm that msvc 2017 x86 (and of course also x64) supports alignment for function parameters.
But msvc 2015 has issues:
- x86 doesn't support alignment at all (only 4-byte alignment is guaranteed (even for types that have a larger "natural" alignment))
- x64 supports function parameters up to "alignas(32)"; ("alignas(64)" results again in an error C2719)
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.
from lockfree.
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?
from lockfree.
Yes, switching to boost.atomic (and adding boost namespace to all the memory_order_... 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!
from lockfree.
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
from lockfree.
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
from lockfree.
Related Issues (20)
- Modular Boost C++ Libraries Request HOT 1
- Lockfree queue delivers data out of order HOT 5
- differering destructor behavior with compile-time size HOT 1
- spsc_queue with compile_time_sized_ringbuffer does not call destructors of remaining queue items when destroyed HOT 3
- compilation error using tagged_ptr_dcas.hpp
- How to contribute code HOT 2
- boost.lockfree tagged_ptr conflict with Hardware-assisted AddressSanitizer(HWASan) from LLVM project HOT 4
- alignment change in 1.77 beta breaks VS 2017 builds HOT 3
- "No constructor could take the source type, or constructor overload resolution was ambiguous" with boost::lockfree::queue::unsynchronized_push
- 1.6.7 lockfree queue, out of order
- Can the Queue be movable? HOT 1
- boost::lockfree queues support r-values and move in push/pop/consume etc? HOT 1
- Lockfree Queue Triggers Thread Sanitizer Data Race Warning HOT 4
- a new lock-free queue HOT 1
- error in tagged_ptr_dcas.hpp about BOOST_ALIGNMENT
- version 1.73 boost::lockfree::queue crash under android 12 when destruct?
- variable-sized queue with a custom allocator is not constructible HOT 1
- Boost CMake testing procedure fails for Lockfree HOT 14
- Reconfiguring with BUILD_TESTING=OFF doesn't disable tests HOT 1
- MacOS: Workaround for extremely slow performance creating lockfree::stack instances (99.999999% for sure a MacOS problem only) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lockfree.