From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 028003858009; Sat, 20 Mar 2021 20:11:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 028003858009 From: "soren.soe at gonsoe dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 9.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: soren.soe at gonsoe dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 20:11:12 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99689 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=3D50439&action=3Dedit preprocessed file (*.i*) that triggers the bug % g++ -v Using built-in specs. COLLECT_GCC=3Dg++ COLLECT_LTO_WRAPPER=3D/usr/lib/gcc/aarch64-linux-gnu/9/lto-wrapper Target: aarch64-linux-gnu Configured with: ../src/configure -v --with-pkgversion=3D'Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=3Dfile:///usr/share/doc/gcc-9/README.B= ugs --enable-languages=3Dc,ada,c++,go,d,fortran,objc,obj-c++,gm2 --prefix=3D/usr --with-gcc-major-version-only --program-suffix=3D-9 --program-prefix=3Daarch64-linux-gnu- --enable-shared --enable-linker-build= -id --libexecdir=3D/usr/lib --without-included-gettext --enable-threads=3Dposix --libdir=3D/usr/lib --enable-nls --enable-clocale=3Dgnu --enable-libstdcxx-= debug --enable-libstdcxx-time=3Dyes --with-default-libstdcxx-abi=3Dnew --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-supp= ort --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=3Dauto --enable-objc-gc=3Dauto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=3Drelease --build=3Daarch64-linux-gnu --host=3Daarch64-linux-gnu --target=3Daarch64-l= inux-gnu Thread model: posix gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)=20 % cat bug.cpp #include #include #include #include using vec =3D std::vector>; 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 =3D 0; for (auto& p : v) m =3D std::max(m, p.first.length()); assert(m =3D=3D 3); } int main() { bad(); return 0; } % g++ -Wall -Wextra -O3 -std=3Dc++14 bug.cpp=20 % ./a.out=20 a.out: bug.cpp:79: void bad(): Assertion `m =3D=3D 3' failed. Aborted (core dumped)=