From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13204 invoked by alias); 10 Sep 2013 15:57:30 -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 13084 invoked by uid 48); 10 Sep 2013 15:57:14 -0000 From: "davidxl at google dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/58377] spurious "may be used uninitialized" warning with -Og Date: Tue, 10 Sep 2013 15:57:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.8.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: davidxl at google dot com X-Bugzilla-Status: NEW 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: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-09/txt/msg00734.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58377 davidxl at google dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |davidxl at google dot com --- Comment #6 from davidxl at google dot com --- There are some spurious PHIs (for out) with -g. Bad dot file (-g): digraph "t.cc.153t.uninit2" { overlap=false; subgraph "int my_pop()" { color="black"; label="int my_pop()"; fn_0_basic_block_1 [shape=Mdiamond,style=filled,fillcolor=white,label="EXIT"]; fn_0_basic_block_2 [shape=record,style=filled,fillcolor=lightgrey,label="{ FREQ:880 |\:\l\ goto\ \;\l\ }"]; fn_0_basic_block_7 [shape=record,style=filled,fillcolor=lightgrey,label="{ FREQ:10000 |\:\l\ |#\ out_2\ =\ PHI\ \\l\ |pop_first_bucket.2_10\ =\ pop_first_bucket;\l\ |if\ (pop_first_bucket.2_10\ !=\ 0)\l\ \ \ goto\ \;\l\ else\l\ \ \ goto\ \;\l\ }"]; fn_0_basic_block_3 [shape=record,style=filled,fillcolor=lightgrey,label="{ FREQ:9550 |\:\l\ |if\ (pop_first_bucket.2_10\ !=\ 0)\l\ \ \ goto\ \;\l\ else\l\ \ \ goto\ \;\l\ }"]; fn_0_basic_block_4 [shape=record,style=filled,fillcolor=lightgrey,label="{ FREQ:2769 |\:\l\ |out_12\ =\ pop\ ();\l\ |if\ (out_12\ !=\ 0)\l\ \ \ goto\ \;\l\ else\l\ \ \ goto\ \;\l\ }"]; fn_0_basic_block_5 [shape=record,style=filled,fillcolor=lightgrey,label="{ FREQ:2520 |\:\l\ }"]; fn_0_basic_block_6 [shape=record,style=filled,fillcolor=lightgrey,label="{ FREQ:9550 |\:\l\ |#\ out_1\ =\ PHI\ \\l\ |#\ iftmp.1_3\ =\ PHI\ \<1(4),\ 0(5),\ 0(3)\>\l\ |if\ (iftmp.1_3\ !=\ 0)\l\ \ \ goto\ \;\l\ else\l\ \ \ goto\ \;\l\ }"]; fn_0_basic_block_8 [shape=record,style=filled,fillcolor=lightgrey,label="{ FREQ:880 |\:\l\ |#\ _4\ =\ PHI\ \\l\ |return\ _4;\l\ }"]; fn_0_basic_block_0 [shape=Mdiamond,style=filled,fillcolor=white,label="ENTRY"]; fn_0_basic_block_0:s -> fn_0_basic_block_2:n [style="solid,bold",color=blue,weight=100,constraint=true, label="[100%]"]; fn_0_basic_block_2:s -> fn_0_basic_block_7:n [style="solid,bold",color=blue,weight=100,constraint=true, label="[100%]"]; fn_0_basic_block_3:s -> fn_0_basic_block_4:n [style="solid,bold",color=black,weight=10,constraint=true, label="[29%]"]; fn_0_basic_block_3:s -> fn_0_basic_block_6:n [style="solid,bold",color=black,weight=10,constraint=true, label="[71%]"]; fn_0_basic_block_4:s -> fn_0_basic_block_6:n [style="solid,bold",color=black,weight=10,constraint=true, label="[9%]"]; fn_0_basic_block_4:s -> fn_0_basic_block_5:n [style="solid,bold",color=black,weight=10,constraint=true, label="[91%]"]; fn_0_basic_block_5:s -> fn_0_basic_block_6:n [style="solid,bold",color=blue,weight=100,constraint=true, label="[100%]"]; fn_0_basic_block_6:s -> fn_0_basic_block_8:n [style="solid,bold",color=black,weight=10,constraint=true, label="[4%]"]; fn_0_basic_block_6:s -> fn_0_basic_block_7:n [style="dotted,bold",color=blue,weight=10,constraint=false, label="[95%]"]; fn_0_basic_block_7:s -> fn_0_basic_block_3:n [style="solid,bold",color=black,weight=10,constraint=true, label="[95%]"]; fn_0_basic_block_7:s -> fn_0_basic_block_8:n [style="solid,bold",color=black,weight=10,constraint=true, label="[4%]"]; fn_0_basic_block_8:s -> fn_0_basic_block_1:n [style="solid,bold",color=black,weight=10,constraint=true, label="[100%]"]; fn_0_basic_block_0:s -> fn_0_basic_block_1:n [style="invis",constraint=true]; } } GCC reports unguarded use of out at return statement. return value is defined by _4 = PHI (out_1(6), 0(7)) where out_1 = PHI (out_12 (4), out_12 (5), out_2 (3)) where out_2 = PHI (out_8(D)(2), out_1 (6)) This phi introduces uninitialized variable use. To compare, the good dot file is : digraph "t.cc.133t.uninit1" { overlap=false; subgraph "int my_pop()" { color="black"; label="int my_pop()"; subgraph cluster_0_1 { style="filled"; color="darkgreen"; fillcolor="grey88"; label="loop 1"; labeljust=l; penwidth=2; fn_0_basic_block_5 [shape=record,style=filled,fillcolor=lightgrey,label="{ FREQ:10000 |\:\l\ |pop_first_bucket.2_10\ =\ pop_first_bucket;\l\ |if\ (pop_first_bucket.2_10\ !=\ 0)\l\ \ \ goto\ \;\l\ else\l\ \ \ goto\ \;\l\ }"]; fn_0_basic_block_3 [shape=record,style=filled,fillcolor=lightgrey,label="{ FREQ:2769 |\:\l\ |out_12\ =\ pop\ ();\l\ |if\ (out_12\ !=\ 0)\l\ \ \ goto\ \;\l\ else\l\ \ \ goto\ \;\l\ }"]; fn_0_basic_block_4 [shape=record,style=filled,fillcolor=lightgrey,label="{ FREQ:2520 |\:\l\ }"]; } fn_0_basic_block_0 [shape=Mdiamond,style=filled,fillcolor=white,label="ENTRY"]; fn_0_basic_block_1 [shape=Mdiamond,style=filled,fillcolor=white,label="EXIT"]; fn_0_basic_block_2 [shape=record,style=filled,fillcolor=lightgrey,label="{ FREQ:880 |\:\l\ goto\ \;\l\ }"]; fn_0_basic_block_6 [shape=record,style=filled,fillcolor=lightgrey,label="{ FREQ:880 |\:\l\ |#\ _4\ =\ PHI\ \\l\ |return\ _4;\l\ }"]; fn_0_basic_block_0:s -> fn_0_basic_block_2:n [style="solid,bold",color=blue,weight=100,constraint=true, label="[100%]"]; fn_0_basic_block_2:s -> fn_0_basic_block_5:n [style="solid,bold",color=blue,weight=100,constraint=true, label="[100%]"]; fn_0_basic_block_3:s -> fn_0_basic_block_6:n [style="solid,bold",color=black,weight=10,constraint=true, label="[9%]"]; fn_0_basic_block_3:s -> fn_0_basic_block_4:n [style="solid,bold",color=black,weight=10,constraint=true, label="[91%]"]; fn_0_basic_block_4:s -> fn_0_basic_block_5:n [style="dotted,bold",color=blue,weight=10,constraint=false, label="[100%]"]; fn_0_basic_block_5:s -> fn_0_basic_block_3:n [style="solid,bold",color=black,weight=10,constraint=true, label="[95%]"]; fn_0_basic_block_5:s -> fn_0_basic_block_6:n [style="solid,bold",color=black,weight=10,constraint=true, label="[4%]"]; fn_0_basic_block_6:s -> fn_0_basic_block_1:n [style="solid,bold",color=black,weight=10,constraint=true, label="[100%]"]; fn_0_basic_block_0:s -> fn_0_basic_block_1:n [style="invis",constraint=true]; } }