public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/102984] New: strange alignment issues with std::vector::emplace/push_back and overaligned type
@ 2021-10-28 11:04 mail at milianw dot de
  2021-10-28 11:13 ` [Bug sanitizer/102984] " jakub at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: mail at milianw dot de @ 2021-10-28 11:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102984

            Bug ID: 102984
           Summary: strange alignment issues with
                    std::vector::emplace/push_back and overaligned type
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mail at milianw dot de
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at gcc dot gnu.org
  Target Milestone: ---

I'm unsure what component to report this bug to, is it an issue with the
sanitizer, compiler or libstdc++?

test.cpp:
```
#include <vector>

struct alignas(64) spinlock { int i = 0; };

int main()
{
    std::vector<spinlock> locks;
    locks.push_back(spinlock());
    return 0;
}
```

Compile with GCC 11.1.0 with ubsan and run:
```
g++ -std=c++20 -O0 -g -fsanitize=address,undefined test.cpp && ./a.out
```

Will produce this output for me:

```
test.cpp:3:20: runtime error: member access within misaligned address
0x7fe2d4898060 for type 'struct spinlock', which requires 64 byte alignment
0x7fe2d4898060: note: pointer points here
 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
00 00 00  00 00 00 00
              ^ 
    #0 0x559ef4c5e453 in spinlock::spinlock() /tmp/test.cpp:3
    #1 0x559ef4c5e166 in main /tmp/test.cpp:8
    #2 0x7fe2d7d4ab24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #3 0x559ef4c5df9d in _start (/tmp/a.out+0x8f9d)

test.cpp:8:21: runtime error: reference binding to misaligned address
0x7fe2d4898060 for type 'struct value_type', which requires 64 byte alignment
0x7fe2d4898060: note: pointer points here
 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
00 00 00  00 00 00 00
              ^ 
    #0 0x559ef4c5e18f in main /tmp/test.cpp:8
    #1 0x7fe2d7d4ab24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #2 0x559ef4c5df9d in _start (/tmp/a.out+0x8f9d)

/usr/include/c++/11.1.0/bits/stl_vector.h:1204:31: runtime error: reference
binding to misaligned address 0x7fe2d4898060 for type 'struct spinlock', which
requires 64 byte alignment
0x7fe2d4898060: note: pointer points here
 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
00 00 00  00 00 00 00
              ^ 
    #0 0x559ef4c5e8fa in std::vector<spinlock, std::allocator<spinlock>
>::push_back(spinlock&&) /usr/include/c++/11.1.0/bits/stl_vector.h:1204
    #1 0x559ef4c5e1a1 in main /tmp/test.cpp:8
    #2 0x7fe2d7d4ab24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #3 0x559ef4c5df9d in _start (/tmp/a.out+0x8f9d)

/usr/include/c++/11.1.0/bits/move.h:105:74: runtime error: reference binding to
misaligned address 0x7fe2d4898060 for type 'struct type', which requires 64
byte alignment
0x7fe2d4898060: note: pointer points here
 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
00 00 00  00 00 00 00
              ^ 
    #0 0x559ef4c5ec0e in std::remove_reference<spinlock&>::type&&
std::move<spinlock&>(spinlock&) /usr/include/c++/11.1.0/bits/move.h:105
    #1 0x559ef4c5e906 in std::vector<spinlock, std::allocator<spinlock>
>::push_back(spinlock&&) /usr/include/c++/11.1.0/bits/stl_vector.h:1204
    #2 0x559ef4c5e1a1 in main /tmp/test.cpp:8
    #3 0x7fe2d7d4ab24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #4 0x559ef4c5df9d in _start (/tmp/a.out+0x8f9d)

/usr/include/c++/11.1.0/bits/stl_vector.h:1204:21: runtime error: reference
binding to misaligned address 0x7fe2d4898060 for type 'struct spinlock', which
requires 64 byte alignment
0x7fe2d4898060: note: pointer points here
 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
00 00 00  00 00 00 00
              ^ 
    #0 0x559ef4c5e92e in std::vector<spinlock, std::allocator<spinlock>
>::push_back(spinlock&&) /usr/include/c++/11.1.0/bits/stl_vector.h:1204
    #1 0x559ef4c5e1a1 in main /tmp/test.cpp:8
    #2 0x7fe2d7d4ab24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #3 0x559ef4c5df9d in _start (/tmp/a.out+0x8f9d)

/usr/include/c++/11.1.0/bits/vector.tcc:121:21: runtime error: reference
binding to misaligned address 0x7fe2d4898060 for type 'struct type', which
requires 64 byte alignment
0x7fe2d4898060: note: pointer points here
 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
00 00 00  00 00 00 00
              ^ 
    #0 0x559ef4c5ef70 in spinlock& std::vector<spinlock,
std::allocator<spinlock> >::emplace_back<spinlock>(spinlock&&)
/usr/include/c++/11.1.0/bits/vector.tcc:121
    #1 0x559ef4c5e93d in std::vector<spinlock, std::allocator<spinlock>
>::push_back(spinlock&&) /usr/include/c++/11.1.0/bits/stl_vector.h:1204
    #2 0x559ef4c5e1a1 in main /tmp/test.cpp:8
    #3 0x7fe2d7d4ab24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #4 0x559ef4c5df9d in _start (/tmp/a.out+0x8f9d)

/usr/include/c++/11.1.0/bits/move.h:78:36: runtime error: reference binding to
misaligned address 0x7fe2d4898060 for type 'struct spinlock', which requires 64
byte alignment
0x7fe2d4898060: note: pointer points here
 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
00 00 00  00 00 00 00
              ^ 
    #0 0x559ef4c5f11d in spinlock&&
std::forward<spinlock>(std::remove_reference<spinlock>::type&)
/usr/include/c++/11.1.0/bits/move.h:78
    #1 0x559ef4c5ef7c in spinlock& std::vector<spinlock,
std::allocator<spinlock> >::emplace_back<spinlock>(spinlock&&)
/usr/include/c++/11.1.0/bits/vector.tcc:121
    #2 0x559ef4c5e93d in std::vector<spinlock, std::allocator<spinlock>
>::push_back(spinlock&&) /usr/include/c++/11.1.0/bits/stl_vector.h:1204
    #3 0x559ef4c5e1a1 in main /tmp/test.cpp:8
    #4 0x7fe2d7d4ab24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #5 0x559ef4c5df9d in _start (/tmp/a.out+0x8f9d)

/usr/include/c++/11.1.0/bits/vector.tcc:449:28: runtime error: reference
binding to misaligned address 0x7fe2d4898060 for type 'struct type', which
requires 64 byte alignment
0x7fe2d4898060: note: pointer points here
 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
00 00 00  00 00 00 00
              ^ 
    #0 0x559ef4c5f871 in void std::vector<spinlock, std::allocator<spinlock>
>::_M_realloc_insert<spinlock>(__gnu_cxx::__normal_iterator<spinlock*,
std::vector<spinlock, std::allocator<spinlock> > >, spinlock&&)
/usr/include/c++/11.1.0/bits/vector.tcc:449
    #1 0x559ef4c5efc8 in spinlock& std::vector<spinlock,
std::allocator<spinlock> >::emplace_back<spinlock>(spinlock&&)
/usr/include/c++/11.1.0/bits/vector.tcc:121
    #2 0x559ef4c5e93d in std::vector<spinlock, std::allocator<spinlock>
>::push_back(spinlock&&) /usr/include/c++/11.1.0/bits/stl_vector.h:1204
    #3 0x559ef4c5e1a1 in main /tmp/test.cpp:8
    #4 0x7fe2d7d4ab24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #5 0x559ef4c5df9d in _start (/tmp/a.out+0x8f9d)

/usr/include/c++/11.1.0/bits/alloc_traits.h:514:21: runtime error: reference
binding to misaligned address 0x7fe2d4898060 for type 'struct type', which
requires 64 byte alignment
0x7fe2d4898060: note: pointer points here
 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
00 00 00  00 00 00 00
              ^ 
    #0 0x559ef4c5f344 in void std::allocator_traits<std::allocator<spinlock>
>::construct<spinlock, spinlock>(std::allocator<spinlock>&, spinlock*,
spinlock&&) /usr/include/c++/11.1.0/bits/alloc_traits.h:514
    #1 0x559ef4c5f941 in void std::vector<spinlock, std::allocator<spinlock>
>::_M_realloc_insert<spinlock>(__gnu_cxx::__normal_iterator<spinlock*,
std::vector<spinlock, std::allocator<spinlock> > >, spinlock&&)
/usr/include/c++/11.1.0/bits/vector.tcc:449
    #2 0x559ef4c5efc8 in spinlock& std::vector<spinlock,
std::allocator<spinlock> >::emplace_back<spinlock>(spinlock&&)
/usr/include/c++/11.1.0/bits/vector.tcc:121
    #3 0x559ef4c5e93d in std::vector<spinlock, std::allocator<spinlock>
>::push_back(spinlock&&) /usr/include/c++/11.1.0/bits/stl_vector.h:1204
    #4 0x559ef4c5e1a1 in main /tmp/test.cpp:8
    #5 0x7fe2d7d4ab24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #6 0x559ef4c5df9d in _start (/tmp/a.out+0x8f9d)

/usr/include/c++/11.1.0/bits/stl_construct.h:97:62: runtime error: reference
binding to misaligned address 0x7fe2d4898060 for type 'struct type', which
requires 64 byte alignment
0x7fe2d4898060: note: pointer points here
 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
00 00 00  00 00 00 00
              ^ 
    #0 0x559ef4c5f15e in decltype (::new ((void*)(0))
spinlock((declval<spinlock>)())) std::construct_at<spinlock,
spinlock>(spinlock*, spinlock&&)
/usr/include/c++/11.1.0/bits/stl_construct.h:97
    #1 0x559ef4c5f362 in void std::allocator_traits<std::allocator<spinlock>
>::construct<spinlock, spinlock>(std::allocator<spinlock>&, spinlock*,
spinlock&&) /usr/include/c++/11.1.0/bits/alloc_traits.h:514
    #2 0x559ef4c5f941 in void std::vector<spinlock, std::allocator<spinlock>
>::_M_realloc_insert<spinlock>(__gnu_cxx::__normal_iterator<spinlock*,
std::vector<spinlock, std::allocator<spinlock> > >, spinlock&&)
/usr/include/c++/11.1.0/bits/vector.tcc:449
    #3 0x559ef4c5efc8 in spinlock& std::vector<spinlock,
std::allocator<spinlock> >::emplace_back<spinlock>(spinlock&&)
/usr/include/c++/11.1.0/bits/vector.tcc:121
    #4 0x559ef4c5e93d in std::vector<spinlock, std::allocator<spinlock>
>::push_back(spinlock&&) /usr/include/c++/11.1.0/bits/stl_vector.h:1204
    #5 0x559ef4c5e1a1 in main /tmp/test.cpp:8
    #6 0x7fe2d7d4ab24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #7 0x559ef4c5df9d in _start (/tmp/a.out+0x8f9d)

/usr/include/c++/11.1.0/bits/stl_construct.h:97:14: runtime error: reference
binding to misaligned address 0x7fe2d4898060 for type 'struct spinlock', which
requires 64 byte alignment
0x7fe2d4898060: note: pointer points here
 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
00 00 00  00 00 00 00
              ^ 
    #0 0x559ef4c5f1a6 in decltype (::new ((void*)(0))
spinlock((declval<spinlock>)())) std::construct_at<spinlock,
spinlock>(spinlock*, spinlock&&)
/usr/include/c++/11.1.0/bits/stl_construct.h:97
    #1 0x559ef4c5f362 in void std::allocator_traits<std::allocator<spinlock>
>::construct<spinlock, spinlock>(std::allocator<spinlock>&, spinlock*,
spinlock&&) /usr/include/c++/11.1.0/bits/alloc_traits.h:514
    #2 0x559ef4c5f941 in void std::vector<spinlock, std::allocator<spinlock>
>::_M_realloc_insert<spinlock>(__gnu_cxx::__normal_iterator<spinlock*,
std::vector<spinlock, std::allocator<spinlock> > >, spinlock&&)
/usr/include/c++/11.1.0/bits/vector.tcc:449
    #3 0x559ef4c5efc8 in spinlock& std::vector<spinlock,
std::allocator<spinlock> >::emplace_back<spinlock>(spinlock&&)
/usr/include/c++/11.1.0/bits/vector.tcc:121
    #4 0x559ef4c5e93d in std::vector<spinlock, std::allocator<spinlock>
>::push_back(spinlock&&) /usr/include/c++/11.1.0/bits/stl_vector.h:1204
    #5 0x559ef4c5e1a1 in main /tmp/test.cpp:8
    #6 0x7fe2d7d4ab24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #7 0x559ef4c5df9d in _start (/tmp/a.out+0x8f9d)

/usr/include/c++/11.1.0/bits/stl_construct.h:97: runtime error: load of
misaligned address 0x7fe2d4898060 for type 'struct spinlock', which requires 64
byte alignment
0x7fe2d4898060: note: pointer points here
 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
00 00 00  00 00 00 00
              ^ 
    #0 0x559ef4c5f1f0 in decltype (::new ((void*)(0))
spinlock((declval<spinlock>)())) std::construct_at<spinlock,
spinlock>(spinlock*, spinlock&&)
/usr/include/c++/11.1.0/bits/stl_construct.h:97
    #1 0x559ef4c5f362 in void std::allocator_traits<std::allocator<spinlock>
>::construct<spinlock, spinlock>(std::allocator<spinlock>&, spinlock*,
spinlock&&) /usr/include/c++/11.1.0/bits/alloc_traits.h:514
    #2 0x559ef4c5f941 in void std::vector<spinlock, std::allocator<spinlock>
>::_M_realloc_insert<spinlock>(__gnu_cxx::__normal_iterator<spinlock*,
std::vector<spinlock, std::allocator<spinlock> > >, spinlock&&)
/usr/include/c++/11.1.0/bits/vector.tcc:449
    #3 0x559ef4c5efc8 in spinlock& std::vector<spinlock,
std::allocator<spinlock> >::emplace_back<spinlock>(spinlock&&)
/usr/include/c++/11.1.0/bits/vector.tcc:121
    #4 0x559ef4c5e93d in std::vector<spinlock, std::allocator<spinlock>
>::push_back(spinlock&&) /usr/include/c++/11.1.0/bits/stl_vector.h:1204
    #5 0x559ef4c5e1a1 in main /tmp/test.cpp:8
    #6 0x7fe2d7d4ab24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #7 0x559ef4c5df9d in _start (/tmp/a.out+0x8f9d)
```

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug sanitizer/102984] strange alignment issues with std::vector::emplace/push_back and overaligned type
  2021-10-28 11:04 [Bug sanitizer/102984] New: strange alignment issues with std::vector::emplace/push_back and overaligned type mail at milianw dot de
@ 2021-10-28 11:13 ` jakub at gcc dot gnu.org
  2021-10-28 11:16 ` mail at milianw dot de
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-10-28 11:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102984

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |redi at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I think this is a user error, I don't think the standard allocator guarantees
such alignment, you'd need to use your own allocator for the container.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug sanitizer/102984] strange alignment issues with std::vector::emplace/push_back and overaligned type
  2021-10-28 11:04 [Bug sanitizer/102984] New: strange alignment issues with std::vector::emplace/push_back and overaligned type mail at milianw dot de
  2021-10-28 11:13 ` [Bug sanitizer/102984] " jakub at gcc dot gnu.org
@ 2021-10-28 11:16 ` mail at milianw dot de
  2021-10-28 11:20 ` [Bug libstdc++/102984] " jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mail at milianw dot de @ 2021-10-28 11:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102984

--- Comment #2 from Milian Wolff <mail at milianw dot de> ---
Similarly:

std::vector<spinlock> locks(10); // works
std::vector<spinlock> locks(10, spinlock()); // doesn't work

This report here was motivated by stumbling over this report over at
https://github.com/efficient/libcuckoo/issues/53. I found a workaround for that
area thankfully, simply by not passing along the default value at all.

@ jakub: Note that it works fine for normal situations, it's only the stack
allocated default arg which triggers this issue. The way I understand
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65122 is that this should be
working with C++17?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libstdc++/102984] strange alignment issues with std::vector::emplace/push_back and overaligned type
  2021-10-28 11:04 [Bug sanitizer/102984] New: strange alignment issues with std::vector::emplace/push_back and overaligned type mail at milianw dot de
  2021-10-28 11:13 ` [Bug sanitizer/102984] " jakub at gcc dot gnu.org
  2021-10-28 11:16 ` mail at milianw dot de
@ 2021-10-28 11:20 ` jakub at gcc dot gnu.org
  2021-10-28 14:37 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-10-28 11:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102984

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|sanitizer                   |libstdc++

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
If C++ is meant to handle that, then it should go under libstdc++ component,
sanitizers just report that it has not been aligned...

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libstdc++/102984] strange alignment issues with std::vector::emplace/push_back and overaligned type
  2021-10-28 11:04 [Bug sanitizer/102984] New: strange alignment issues with std::vector::emplace/push_back and overaligned type mail at milianw dot de
                   ` (2 preceding siblings ...)
  2021-10-28 11:20 ` [Bug libstdc++/102984] " jakub at gcc dot gnu.org
@ 2021-10-28 14:37 ` redi at gcc dot gnu.org
  2021-10-28 14:40 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2021-10-28 14:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102984

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #1)
> I think this is a user error, I don't think the standard allocator
> guarantees such alignment, you'd need to use your own allocator for the
> container.

It has to work since C++17.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libstdc++/102984] strange alignment issues with std::vector::emplace/push_back and overaligned type
  2021-10-28 11:04 [Bug sanitizer/102984] New: strange alignment issues with std::vector::emplace/push_back and overaligned type mail at milianw dot de
                   ` (3 preceding siblings ...)
  2021-10-28 14:37 ` redi at gcc dot gnu.org
@ 2021-10-28 14:40 ` redi at gcc dot gnu.org
  2021-10-28 19:58 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2021-10-28 14:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102984

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is probably the _Temporary_value helper used by std::vector. I already
have a patch to overhaul that so it works in constant expressions, so I'll fix
this too

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libstdc++/102984] strange alignment issues with std::vector::emplace/push_back and overaligned type
  2021-10-28 11:04 [Bug sanitizer/102984] New: strange alignment issues with std::vector::emplace/push_back and overaligned type mail at milianw dot de
                   ` (4 preceding siblings ...)
  2021-10-28 14:40 ` redi at gcc dot gnu.org
@ 2021-10-28 19:58 ` redi at gcc dot gnu.org
  2021-10-28 20:01 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2021-10-28 19:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102984

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #5)
> This is probably the _Temporary_value helper used by std::vector.

Nope, that uses a correctly-aligned buffer.

The misaligned object is the default-initialized rvalue created here:

    locks.push_back(spinlock());

There is nothing libstdc++ can do here, that misaligned object is created by
the compiler before any libstdc++ sees it.

However, I'm unable to reproduce this with 11.1 or any other version.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libstdc++/102984] strange alignment issues with std::vector::emplace/push_back and overaligned type
  2021-10-28 11:04 [Bug sanitizer/102984] New: strange alignment issues with std::vector::emplace/push_back and overaligned type mail at milianw dot de
                   ` (5 preceding siblings ...)
  2021-10-28 19:58 ` redi at gcc dot gnu.org
@ 2021-10-28 20:01 ` redi at gcc dot gnu.org
  2021-10-29  7:35 ` mail at milianw dot de
  2021-10-29  8:09 ` redi at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2021-10-28 20:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102984

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-10-28
             Status|UNCONFIRMED                 |WAITING
     Ever confirmed|0                           |1

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The ubsan errors can't be reproduced in godbolt.org either.

Please provide all the missing information that you were asked to provide by
https://gcc.gnu.org/bugs/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libstdc++/102984] strange alignment issues with std::vector::emplace/push_back and overaligned type
  2021-10-28 11:04 [Bug sanitizer/102984] New: strange alignment issues with std::vector::emplace/push_back and overaligned type mail at milianw dot de
                   ` (6 preceding siblings ...)
  2021-10-28 20:01 ` redi at gcc dot gnu.org
@ 2021-10-29  7:35 ` mail at milianw dot de
  2021-10-29  8:09 ` redi at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: mail at milianw dot de @ 2021-10-29  7:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102984

Milian Wolff <mail at milianw dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|WAITING                     |RESOLVED

--- Comment #8 from Milian Wolff <mail at milianw dot de> ---
Hey Jonathan,

that's quite odd... Today I fail to reproduce this on my system too. Yesterday
I also noticed that it worked on godbolt but forgot to mention it here - sorry
about that. I also tried to reduce this issue to passing aligned temporaries in
code outside of std::vector, but that didn't help either. And when I'm trying
today, the issue suddenly vanished, maybe there was a system update which
helped in that regard, mysterious.

For the record, here's the requested information from today, which does _not_
show the broken behavior anymore.

    the exact version of GCC;

g++ (GCC) 11.1.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


    the system type;

Linux milian-workstation 5.14.14-arch1-1 #1 SMP PREEMPT Wed, 20 Oct 2021
21:35:18 +0000 x86_64 GNU/Linux

ArchLinux with all latest updates

    the options given when GCC was configured/built;

g++ --verbose
Using built-in specs.
COLLECT_GCC=/usr/bin/g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --with-isl
--with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit
--enable-cet=auto --enable-checking=release --enable-clocale=gnu
--enable-default-pie --enable-default-ssp --enable-gnu-indirect-function
--enable-gnu-unique-object --enable-install-libiberty --enable-linker-build-id
--enable-lto --enable-multilib --enable-plugin --enable-shared
--enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-libunwind-exceptions --disable-werror
gdc_include_dir=/usr/include/dlang/gdc
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.1.0 (GCC) 

    the complete command line that triggers the bug;
    the compiler output (error messages, warnings, etc.); and

both specified in the original message already

    the preprocessed file (*.i*) that triggers the bug, generated by adding
-save-temps to the complete compilation command, or, in the case of a bug
report for the GNAT front end, a complete set of source files (see below).

I'm going to close this report and will reopen it with more details once I can
reproduce this again.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libstdc++/102984] strange alignment issues with std::vector::emplace/push_back and overaligned type
  2021-10-28 11:04 [Bug sanitizer/102984] New: strange alignment issues with std::vector::emplace/push_back and overaligned type mail at milianw dot de
                   ` (7 preceding siblings ...)
  2021-10-29  7:35 ` mail at milianw dot de
@ 2021-10-29  8:09 ` redi at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2021-10-29  8:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102984

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |WORKSFORME

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Not FIXED then, because there was nothing to fix. WORKSFORME is the right
resolution.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-10-29  8:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-28 11:04 [Bug sanitizer/102984] New: strange alignment issues with std::vector::emplace/push_back and overaligned type mail at milianw dot de
2021-10-28 11:13 ` [Bug sanitizer/102984] " jakub at gcc dot gnu.org
2021-10-28 11:16 ` mail at milianw dot de
2021-10-28 11:20 ` [Bug libstdc++/102984] " jakub at gcc dot gnu.org
2021-10-28 14:37 ` redi at gcc dot gnu.org
2021-10-28 14:40 ` redi at gcc dot gnu.org
2021-10-28 19:58 ` redi at gcc dot gnu.org
2021-10-28 20:01 ` redi at gcc dot gnu.org
2021-10-29  7:35 ` mail at milianw dot de
2021-10-29  8:09 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).