Skip to content

Suppress another GCC 16 warning - #60

Open
soerengrunewald wants to merge 1 commit into
mainfrom
suppress-another-gcc-warning
Open

Suppress another GCC 16 warning#60
soerengrunewald wants to merge 1 commit into
mainfrom
suppress-another-gcc-warning

Conversation

@soerengrunewald

Copy link
Copy Markdown
Contributor

Why

The compiler complains about this:

In static member function ‘static std::enable_if_t<((bool)std::is_nothrow_move_constructible<T>::value)> gul17::SmallVector<ElementT, in_capacity>::uninitialized_move(T*, T*, T*) [with T = unsigned int; ElementT = unsigned int; long unsigned int in_capacity = 8]’,
    inlined from ‘static std::enable_if_t<((bool)std::is_nothrow_move_constructible<T>::value)> gul17::SmallVector<ElementT, in_capacity>::uninitialized_move_or_copy(T*, T*, T*) [with T = unsigned int; ElementT = unsigned int; long unsigned int in_capacity = 8]’ at gul17/SmallVector.h:1676:27,
    inlined from ‘void gul17::SmallVector<ElementT, in_capacity>::move_or_copy_all_elements_from(gul17::SmallVector<ElementT, in_capacity>&&) [with ElementT = unsigned int; long unsigned int in_capacity = 8]’ at gul17/SmallVector.h:1560:39,
    inlined from ‘void gul17::SmallVector<ElementT, in_capacity>::move_or_copy_all_elements_from(gul17::SmallVector<ElementT, in_capacity>&&) [with ElementT = unsigned int; long unsigned int in_capacity = 8]’ at gul17/SmallVector.h:1546:10,
---8<---
    inlined from ‘void CATCH2_INTERNAL_TEST_188()’ at clientlib/tests/test_serialization.cc:3305:1:
gul17/SmallVector.h:1664:13: warning: ‘void* __builtin_memcpy(void*, const void*, long unsigned int)’ forming offset [440, 751] is out of the bounds [0, 440] of object ‘<anonymous>’ with type ‘const doocs::Field [5]’ [-Warray-bounds=]
 1664 |             ::new (static_cast<void*>(dest)) ValueType(std::move(*src));
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

How

Disable the warning for now. But if we do so, we trigger a second warning, which we need to disable as well.

This is a followup to #59

[Why]
The compiler complains about this:
> In static member function ‘static std::enable_if_t<((bool)std::is_nothrow_move_constructible<T>::value)> gul17::SmallVector<ElementT, in_capacity>::uninitialized_move(T*, T*, T*) [with T = unsigned int; ElementT = unsigned int; long unsigned int in_capacity = 8]’,
>     inlined from ‘static std::enable_if_t<((bool)std::is_nothrow_move_constructible<T>::value)> gul17::SmallVector<ElementT, in_capacity>::uninitialized_move_or_copy(T*, T*, T*) [with T = unsigned int; ElementT = unsigned int; long unsigned int in_capacity = 8]’ at gul17/SmallVector.h:1676:27,
>     inlined from ‘void gul17::SmallVector<ElementT, in_capacity>::move_or_copy_all_elements_from(gul17::SmallVector<ElementT, in_capacity>&&) [with ElementT = unsigned int; long unsigned int in_capacity = 8]’ at gul17/SmallVector.h:1560:39,
>     inlined from ‘void gul17::SmallVector<ElementT, in_capacity>::move_or_copy_all_elements_from(gul17::SmallVector<ElementT, in_capacity>&&) [with ElementT = unsigned int; long unsigned int in_capacity = 8]’ at gul17/SmallVector.h:1546:10,
> ---8<---
>     inlined from ‘void CATCH2_INTERNAL_TEST_188()’ at clientlib/tests/test_serialization.cc:3305:1:
> gul17/SmallVector.h:1664:13: warning: ‘void* __builtin_memcpy(void*, const void*, long unsigned int)’ forming offset [440, 751] is out of the bounds [0, 440] of object ‘<anonymous>’ with type ‘const doocs::Field [5]’ [-Warray-bounds=]
>  1664 |             ::new (static_cast<void*>(dest)) ValueType(std::move(*src));
>       |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[How]
Disable the warning for now. But if we do so, we trigger a second
warning, which we need to disable as well.

Signed-off-by: Soeren Grunewald <soeren.grunewald@desy.de>
@alt-graph

Copy link
Copy Markdown
Member

Maybe we could add a short comment on why this suppression is necessary and on what compiler?

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

Successfully merging this pull request may close these issues.

2 participants