From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 35DD63858D1E; Fri, 30 Sep 2022 19:22:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 35DD63858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664565776; bh=8+/KLEMlRVX5MJwAJOqiR6VXRxlY3ErsuoyYoLhdjVs=; h=From:To:Subject:Date:From; b=pADOObbgi4gXoUQg0KjroitbkOW9WRkWnFPkZ71AcicIB9oNJRuByNNbrYDN5dmAt aexokPOPkCxL4oOYpn/FXDqEnP3Q/u7RKzg5pt823BMiM9heqoWpED/7uReJPgmaId /c2PEYtdr2y6Tro27wP0q7Lru9ptuCJxtDhampTM= From: "jlame646 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107106] New: Incorrect use of uninitialized value warning Date: Fri, 30 Sep 2022 19:22:55 +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: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jlame646 at gmail 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 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107106 Bug ID: 107106 Summary: Incorrect use of uninitialized value warning Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jlame646 at gmail dot com Target Milestone: --- The following program with `-fanalyzer` flag produces incorrect warning. De= mo: https://godbolt.org/z/YWd4cKbGc ``` #include std::string square(int num) { return std::to_string(num * num); } ``` The warning says: ``` : In function 'std::string square(int)': :4:36: warning: use of uninitialized value '' [CWE-457] [-Wanalyzer-use-of-uninitialized-value] 4 | return std::to_string(num * num); | ^ 'std::string square(int)': events 1-2 | | 3 | std::string square(int num) { | | ^ | | | | | (1) region created on stack here | 4 | return std::to_string(num * num); | | ~ | | | | | (2) use of uninitialized va= lue '' here | :4:36: warning: use of uninitialized value '' [CWE-457] [-Wanalyzer-use-of-uninitialized-value] 4 | return std::to_string(num * num); | ^ 'std::string square(int)': events 1-2 | | 3 | std::string square(int num) { | | ^ | | | | | (1) region created on stack here | 4 | return std::to_string(num * num); | | ~ | | | | | (2) use of uninitialized va= lue '' here | ``` On searching for possible dupes, i came across this: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D13025 that may be related to= this bug.=