public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95349] New: Using std::launder(p) produces unexpected behavior where (p) produces expected behavior
@ 2020-05-26 20:45 andrew2085 at gmail dot com
  2020-05-27  8:04 ` [Bug c++/95349] " rguenth at gcc dot gnu.org
                   ` (51 more replies)
  0 siblings, 52 replies; 53+ messages in thread
From: andrew2085 at gmail dot com @ 2020-05-26 20:45 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95349
           Summary: Using std::launder(p) produces unexpected behavior
                    where (p) produces expected behavior
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andrew2085 at gmail dot com
  Target Milestone: ---

Created attachment 48609
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48609&action=edit
preprocessed ii file

All of these f1/f2/f3 functions should do the same thing, essentially the same
thing as std::start_lifetime_as. Since the return value of placement new is
used, std::launder is not necessary here, but using it anyway produces
unexpected behavior when it should do nothing at all. Every version of gcc and
every system I've tried has produced the same result.

Here's the original source for reference: https://godbolt.org/z/zdQsfV

gcc version: 10.1.0 (All other versions tested produce same behavior)

system: Arch Linux x86_64

compile command: g++ -save-temps -std=c++17 -O2 -fno-stack-protector
-fstrict-aliasing main.cpp && ./a.out

configure options: g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/10.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 10.1.0 (GCC)

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

end of thread, other threads:[~2024-06-03 16:00 UTC | newest]

Thread overview: 53+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-26 20:45 [Bug c++/95349] New: Using std::launder(p) produces unexpected behavior where (p) produces expected behavior andrew2085 at gmail dot com
2020-05-27  8:04 ` [Bug c++/95349] " rguenth at gcc dot gnu.org
2020-05-27  9:14 ` redi at gcc dot gnu.org
2020-05-27  9:40 ` rguenther at suse dot de
2020-05-27 11:05 ` redi at gcc dot gnu.org
2020-05-27 14:45 ` andrew2085 at gmail dot com
2020-05-27 15:07 ` redi at gcc dot gnu.org
2020-05-27 15:19 ` andrew2085 at gmail dot com
2020-05-27 16:01 ` andrew2085 at gmail dot com
2020-05-29 10:59 ` ed at catmur dot uk
2020-05-29 11:23 ` rguenth at gcc dot gnu.org
2020-05-29 11:32 ` rguenth at gcc dot gnu.org
2020-05-29 13:53 ` ed at catmur dot uk
2020-05-29 14:15 ` redi at gcc dot gnu.org
2020-05-29 14:24 ` rguenther at suse dot de
2020-05-29 15:05 ` andrew2085 at gmail dot com
2020-05-29 18:07 ` richard-gccbugzilla at metafoo dot co.uk
2020-05-29 21:00 ` andrew2085 at gmail dot com
2020-05-29 21:50 ` richard-gccbugzilla at metafoo dot co.uk
2020-05-29 23:13 ` andrew2085 at gmail dot com
2020-05-29 23:25 ` richard-gccbugzilla at metafoo dot co.uk
2020-06-02 12:09 ` rguenth at gcc dot gnu.org
2020-06-02 12:20 ` rguenth at gcc dot gnu.org
2020-06-02 16:00 ` andrew2085 at gmail dot com
2020-06-02 16:23 ` rguenther at suse dot de
2020-06-02 16:34 ` andrew2085 at gmail dot com
2020-06-02 16:37 ` andrew2085 at gmail dot com
2020-06-02 17:54 ` rguenther at suse dot de
2020-06-02 18:43 ` andrew2085 at gmail dot com
2020-06-02 20:53 ` andrew2085 at gmail dot com
2020-06-03  6:52 ` rguenth at gcc dot gnu.org
2020-06-04  0:27 ` andrew2085 at gmail dot com
2020-06-04  6:14 ` rguenther at suse dot de
2020-06-04 16:05 ` andrew2085 at gmail dot com
2020-06-05  6:52 ` rguenth at gcc dot gnu.org
2020-06-05 14:30 ` andrew2085 at gmail dot com
2020-06-15  9:29 ` rguenth at gcc dot gnu.org
2020-06-15 21:45 ` richard-gccbugzilla at metafoo dot co.uk
2020-06-16  3:27 ` andrew2085 at gmail dot com
2020-06-16  6:50 ` rguenther at suse dot de
2020-06-16  6:57 ` rguenther at suse dot de
2020-06-16 13:56 ` andrew2085 at gmail dot com
2022-01-11 12:43 ` rguenth at gcc dot gnu.org
2022-01-11 12:48 ` rguenth at gcc dot gnu.org
2022-11-14  4:53 ` andrew2085 at gmail dot com
2024-06-03  8:02 ` Christopher.Nerz at de dot bosch.com
2024-06-03  8:51 ` rguenth at gcc dot gnu.org
2024-06-03  9:13 ` Christopher.Nerz at de dot bosch.com
2024-06-03  9:23 ` rguenth at gcc dot gnu.org
2024-06-03 10:26 ` Christopher.Nerz at de dot bosch.com
2024-06-03 11:19 ` rguenther at suse dot de
2024-06-03 15:53 ` redi at gcc dot gnu.org
2024-06-03 16:00 ` 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).