public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "soren.soe at gonsoe dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/99689] New: Initialized local variable becomes uninitialized after use Date: Sat, 20 Mar 2021 20:11:11 +0000 [thread overview] Message-ID: <bug-99689-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99689 Bug ID: 99689 Summary: Initialized local variable becomes uninitialized after use Product: gcc Version: 9.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: soren.soe at gonsoe dot com Target Milestone: --- Created attachment 50439 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50439&action=edit preprocessed file (*.i*) that triggers the bug % g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/9/lto-wrapper Target: aarch64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu Thread model: posix gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) % cat bug.cpp #include <cassert> #include <string> #include <utility> #include <vector> using vec = std::vector<std::pair<std::string, std::string>>; void bad() { vec v; v.emplace_back("abc", "def"); v.emplace_back("abc", "def"); v.emplace_back("abc", "def"); v.emplace_back("abc", "def"); v.emplace_back("abc", "def"); unsigned int m = 0; for (auto& p : v) m = std::max<unsigned int>(m, p.first.length()); assert(m == 3); } int main() { bad(); return 0; } % g++ -Wall -Wextra -O3 -std=c++14 bug.cpp % ./a.out a.out: bug.cpp:79: void bad(): Assertion `m == 3' failed. Aborted (core dumped)
next reply other threads:[~2021-03-20 20:11 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-20 20:11 soren.soe at gonsoe dot com [this message] 2021-03-20 20:11 ` [Bug c++/99689] " soren.soe at gonsoe dot com 2021-03-20 20:46 ` [Bug middle-end/99689] " pinskia at gcc dot gnu.org 2021-03-22 8:11 ` marxin at gcc dot gnu.org 2021-03-22 8:17 ` jakub at gcc dot gnu.org 2021-03-22 19:42 ` gnu at gonsoe dot com 2021-03-23 1:52 ` gnu at gonsoe dot com 2024-02-28 7:26 ` pinskia at gcc dot gnu.org 2024-02-28 7:51 ` pinskia at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-99689-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).