GithubHelp home page GithubHelp logo

Comments (9)

timblechmann avatar timblechmann commented on August 22, 2024

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.

stefan-floeren avatar stefan-floeren commented on August 22, 2024

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.

tobias-loew avatar tobias-loew commented on August 22, 2024

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.

timblechmann avatar timblechmann commented on August 22, 2024

hmm, i've tested msvc 2017 ia32, which builds fine :/

from lockfree.

tobias-loew avatar tobias-loew commented on August 22, 2024

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.

timblechmann avatar timblechmann commented on August 22, 2024

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.

tobias-loew avatar tobias-loew commented on August 22, 2024

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.

mmakhalaf avatar mmakhalaf commented on August 22, 2024

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.

rooong avatar rooong commented on August 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.