From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25578 invoked by alias); 25 Apr 2013 18:01:01 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 25557 invoked by uid 48); 25 Apr 2013 18:00:58 -0000 From: "ppluzhnikov at google dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/57072] New: bogus "is used uninitialized" warning Date: Thu, 25 Apr 2013 18:01:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ppluzhnikov at google dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-SW-Source: 2013-04/txt/msg02116.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D57072 Bug #: 57072 Summary: bogus "is used uninitialized" warning Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: ppluzhnikov@google.com Google ref: b/8700048 Test: struct A { ~A() __attribute__((noreturn)); A& stream(); template void operator<<(T&); }; struct C { enum State { S1, S2 }; static bool Fn(State s) { switch (s) { case S2: A().stream() << s; } } }; void TestFn() { for (int i =3D 0; i < 2; ++i) { C::Fn ? (void) 0 : A().stream() << " "; C::Fn(static_cast(i)); } } Using g++ (GCC) 4.9.0 20130412 (experimental) (r197936): g++ -c -Wuninitialized -O2 -fno-tree-vrp t.cc t.cc: In function =E2=80=98void TestFn()=E2=80=99: t.cc:16:6: warning: =E2=80=98s=E2=80=99 is used uninitialized in this funct= ion [-Wuninitialized] void TestFn() ^ This warning doesn't trigger on 4_7-branch, but a slightly less reduced test case does, so it's likely not a recent regression. >>From gcc-bugs-return-420972-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Apr 25 18:04:29 2013 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 27294 invoked by alias); 25 Apr 2013 18:04:28 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 27268 invoked by uid 48); 25 Apr 2013 18:04:25 -0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/57073] New: __builtin_powif (-1.0, k) should be optimized to "1.0 - 2.0 * (K%2)" Date: Thu, 25 Apr 2013 18:04:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 X-SW-Source: 2013-04/txt/msg02117.txt.bz2 Content-length: 910 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57073 Bug #: 57073 Summary: __builtin_powif (-1.0, k) should be optimized to "1.0 - 2.0 * (K%2)" Classification: Unclassified Product: gcc Version: 4.9.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned@gcc.gnu.org ReportedBy: burnus@gcc.gnu.org Motivated by PR57071. In numerical code, it is not unlike to find code of the form "(-1.0) raised to the power of k", in Fortran: (-1.0)**k. That translates into: __builtin_powif (-1.0e+0, k) which stays that way even with -O3. Expected: It gets optimized to "1.0 - 2.0 * (K%2)" Fortran test case: real function f(k) integer, value :: k f = (-1.0)**k end