From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 66A1C3858001; Thu, 11 Mar 2021 01:36:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 66A1C3858001 From: "wuz73 at hotmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/99536] New: unexplained warning on "uninitialized value" Date: Thu, 11 Mar 2021 01:36:21 +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: 5.3.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: wuz73 at hotmail 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 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: Thu, 11 Mar 2021 01:36:21 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99536 Bug ID: 99536 Summary: unexplained warning on "uninitialized value" Product: gcc Version: 5.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: wuz73 at hotmail dot com Target Milestone: --- Although the example in http://www.cplusplus.com/reference/random/normal_distribution/ compiled fin= e, I got a warning on uninitialized value in a similar code below. #include void foo(double); int main() { std::default_random_engine generator; std::normal_distribution norm_dist(0,1); for(int i=3D0; i<3; i++) foo(norm_dist(generator)); return 0; } When compiled with "g++ -std=3Dc++11 -Wall -ffast-math -O -c foo.cpp" using gcc5.3.1 on CentOS7.2, I got: foo.cpp:8:30: warning: =E2=80=98norm_dist.std::normal_distribution::_M_save= d=E2=80=99 may be used uninitialized in this function [-Wmaybe-uninitialized] foo(norm_dist(generator)); Note that without -O, -ffast-math, or the for-loop, the code compiled fine without any warning.=