Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect const qualifier? #15

Closed
DavidCallahan opened this issue Jul 16, 2018 · 8 comments
Closed

Incorrect const qualifier? #15

DavidCallahan opened this issue Jul 16, 2018 · 8 comments

Comments

@DavidCallahan
Copy link

Using a near-trunk build of clang which as a new semantic check, I get this error:

include/boost/atomic/detail/ops_gcc_x86_dcas.hpp:408:16: error: address argume\nt to atomic builtin cannot be const-qualified ('const volatile boost::atomics::detail::gcc_dcas_x86_64::storage_type *' (aka 'constvolatile unsigned __int128 *') invalid)
        return __sync_val_compare_and_swap(&storage, value, value);
               ^                           ~~~~~~~~
1 error generated.

which is generated due to the "const" declaration in this static function:
https://github.com/boostorg/atomic/blob/develop/include/boost/atomic/detail/ops_gcc_x86_dcas.hpp#L402

The error seems correct but so does the code. I worked around this by casting away the const operand to the intrinsic.

        return __sync_val_compare_and_swap(
            const_cast<storage_type volatile*>(&storage), value, value);
@Lastique
Copy link
Member

I can't reproduce this. What clang version do you use?

@Lastique
Copy link
Member

Lastique commented Jul 18, 2018 via email

@fiesh
Copy link

fiesh commented Dec 5, 2018

With boost 1.67 and clang-7, I can reproduce the issue with this:

echo '#include <boost/log/utility/setup.hpp>' > /tmp/a.cpp && clang++ -c -march=haswell /tmp/a.cpp
In file included from /tmp/a.cpp:1:
In file included from /usr/include/boost/log/utility/setup.hpp:20:
In file included from /usr/include/boost/log/utility/setup/common_attributes.hpp:22:
In file included from /usr/include/boost/log/attributes/counter.hpp:26:
In file included from /usr/include/boost/atomic/atomic.hpp:20:
In file included from /usr/include/boost/atomic/fences.hpp:21:
In file included from /usr/include/boost/atomic/detail/operations.hpp:17:
In file included from /usr/include/boost/atomic/detail/operations_lockfree.hpp:21:
In file included from /usr/include/boost/atomic/detail/ops_gcc_atomic.hpp:24:
/usr/include/boost/atomic/detail/ops_gcc_x86_dcas.hpp:408:16: error: address argument to atomic builtin cannot be const-qualified ('const volatile boost::atomics::detail::gcc_dcas_x86_64::storage_type *'
      (aka 'const volatile unsigned __int128 *') invalid)
        return __sync_val_compare_and_swap(&storage, value, value);
               ^                           ~~~~~~~~
1 error generated.

@fiesh
Copy link

fiesh commented Dec 18, 2018

6e14ca2 indeed fixes the issue -- boost 1.69 works! Thanks!

@Lastique
Copy link
Member

Lastique commented Dec 18, 2018 via email

@fiesh
Copy link

fiesh commented Dec 19, 2018

On 12/18/18 3:18 PM, fiesh wrote: @Lastique Any chance this can be re-opened?
No, the problem has been fixed already.

Yeah that's why I had removed the comment before your answer and replaced it with the other one.

tchaikov added a commit to tchaikov/ceph that referenced this issue Jul 18, 2019
* we've moved to cmake 3.5, so no need to hack for newer cmake
* nss dependency is dropped, no need to install it anymore
* pass clang and clang++ using cmake variable to be more consistent
* pass CMAKE_EXE_LINKER_FLAGS as `/usr/local/opt/llvm/lib` is
  not in default library paths.
* mention boostorg/atomic#15

Signed-off-by: Kefu Chai <kchai@redhat.com>
tchaikov added a commit to tchaikov/ceph that referenced this issue Jul 18, 2019
* we've moved to cmake 3.5, so no need to hack for newer cmake
* nss dependency is dropped, no need to install it anymore
* pass clang and clang++ using cmake variable to be more consistent
* pass CMAKE_EXE_LINKER_FLAGS as `/usr/local/opt/llvm/lib` is
  not in default library paths.
* mention boostorg/atomic#15

Signed-off-by: Kefu Chai <kchai@redhat.com>
tchaikov added a commit to tchaikov/ceph that referenced this issue Jul 19, 2019
* we've moved to cmake 3.5, so no need to hack for newer cmake
* nss dependency is dropped, no need to install it anymore
* pass clang and clang++ using cmake variable to be more consistent
* pass CMAKE_EXE_LINKER_FLAGS as `/usr/local/opt/llvm/lib` is
  not in default library paths.
* mention boostorg/atomic#15

Signed-off-by: Kefu Chai <kchai@redhat.com>
tchaikov added a commit to tchaikov/ceph that referenced this issue Jul 19, 2019
* we've moved to cmake 3.5, so no need to hack for newer cmake
* nss dependency is dropped, no need to install it anymore
* pass clang and clang++ using cmake variable to be more consistent
* pass CMAKE_EXE_LINKER_FLAGS as `/usr/local/opt/llvm/lib` is
  not in default library paths.
* mention boostorg/atomic#15

Signed-off-by: Kefu Chai <kchai@redhat.com>
tchaikov added a commit to tchaikov/ceph that referenced this issue Jul 19, 2019
* we've moved to cmake 3.5, so no need to hack for newer cmake
* nss dependency is dropped, no need to install it anymore
* pass clang and clang++ using cmake variable to be more consistent
* pass CMAKE_EXE_LINKER_FLAGS as `/usr/local/opt/llvm/lib` is
  not in default library paths.
* mention boostorg/atomic#15

Signed-off-by: Kefu Chai <kchai@redhat.com>
tchaikov added a commit to tchaikov/ceph that referenced this issue Jul 19, 2019
* we've moved to cmake 3.5, so no need to hack for newer cmake
* nss dependency is dropped, no need to install it anymore
* pass clang and clang++ using cmake variable to be more consistent
* pass CMAKE_EXE_LINKER_FLAGS as `/usr/local/opt/llvm/lib` is
  not in default library paths.
* mention boostorg/atomic#15

Signed-off-by: Kefu Chai <kchai@redhat.com>
tchaikov added a commit to tchaikov/ceph that referenced this issue Jul 19, 2019
* we've moved to cmake 3.5, so no need to hack for newer cmake
* nss dependency is dropped, no need to install it anymore
* pass clang and clang++ using cmake variable to be more consistent
* pass CMAKE_EXE_LINKER_FLAGS as `/usr/local/opt/llvm/lib` is
  not in default library paths.
* mention boostorg/atomic#15

Signed-off-by: Kefu Chai <kchai@redhat.com>
tchaikov added a commit to tchaikov/ceph that referenced this issue Jul 20, 2019
* we've moved to cmake 3.5, so no need to hack for newer cmake
* nss dependency is dropped, no need to install it anymore
* pass clang and clang++ using cmake variable to be more consistent
* pass CMAKE_EXE_LINKER_FLAGS as `/usr/local/opt/llvm/lib` is
  not in default library paths.
* mention boostorg/atomic#15

Signed-off-by: Kefu Chai <kchai@redhat.com>
tchaikov added a commit to tchaikov/ceph that referenced this issue Jul 20, 2019
* we've moved to cmake 3.5, so no need to hack for newer cmake
* nss dependency is dropped, no need to install it anymore
* pass clang and clang++ using cmake variable to be more consistent
* pass CMAKE_EXE_LINKER_FLAGS as `/usr/local/opt/llvm/lib` is
  not in default library paths.
* mention boostorg/atomic#15

Signed-off-by: Kefu Chai <kchai@redhat.com>
tchaikov added a commit to tchaikov/ceph that referenced this issue Jul 20, 2019
* we've moved to cmake 3.5, so no need to hack for newer cmake
* nss dependency is dropped, no need to install it anymore
* pass clang and clang++ using cmake variable to be more consistent
* pass CMAKE_EXE_LINKER_FLAGS as `/usr/local/opt/llvm/lib` is
  not in default library paths.
* mention boostorg/atomic#15

Signed-off-by: Kefu Chai <kchai@redhat.com>
dziomdziorae pushed a commit to dziomdziorae/ceph that referenced this issue Jul 23, 2019
* we've moved to cmake 3.5, so no need to hack for newer cmake
* nss dependency is dropped, no need to install it anymore
* pass clang and clang++ using cmake variable to be more consistent
* pass CMAKE_EXE_LINKER_FLAGS as `/usr/local/opt/llvm/lib` is
  not in default library paths.
* mention boostorg/atomic#15

Signed-off-by: Kefu Chai <kchai@redhat.com>
@timgivois
Copy link

So basically, this is fixed in 1.69 which is incompatible with MacOS and that means you won't fix 1.67....

@bilalebi
Copy link

bilalebi commented Apr 8, 2020

I had the same issue but upgrading to boost 1.72 solved it.

I'm on Mac Catalina

eric-swanson added a commit to polserver/polserver that referenced this issue Oct 19, 2020
eric-swanson added a commit to polserver/polserver that referenced this issue Dec 6, 2020
turleypol added a commit to polserver/polserver that referenced this issue Dec 23, 2020
* boost 1.69

Due to this: boostorg/atomic#15

* build boost with libs for asio

* Boost 1.74

Download from dl.bintray.com/boostorg/ because Boost 1.74 .bz2 is larger than GitHub will allow without LFS

* set BUILD_BYPRODUCTS (just setting one library, and doesn't handle windows..  I don't know what is correct anyway)

* build with b2

* Try Boost.cmake from Kevin

* Specify toolset in configure command line

* Use POL_EXT_LIB_DIR.  Make clib depend on boost, not pol itself

* cache boost for github actions

* Copy-pasta correction

* Cache boost for additional github build workflows

* cache boost for coverage build, updated cache action version

Co-authored-by: Kevin Eady <8634912+KevinEady@users.noreply.github.com>
Co-authored-by: turleypol <turley@polserver.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants