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 |\<bb\ 2\>:\l\
goto\ \<bb\ 7\>;\l\
}"];

    fn_0_basic_block_7 [shape=record,style=filled,fillcolor=lightgrey,label="{
FREQ:10000 |\<bb\ 7\>:\l\
|#\ out_2\ =\ PHI\ \<out_8(D)(2),\ out_1(6)\>\l\
|pop_first_bucket.2_10\ =\ pop_first_bucket;\l\
|if\ (pop_first_bucket.2_10\ !=\ 0)\l\
\ \ goto\ \<bb\ 3\>;\l\
else\l\
\ \ goto\ \<bb\ 8\>;\l\
}"];

    fn_0_basic_block_3 [shape=record,style=filled,fillcolor=lightgrey,label="{
FREQ:9550 |\<bb\ 3\>:\l\
|if\ (pop_first_bucket.2_10\ !=\ 0)\l\
\ \ goto\ \<bb\ 4\>;\l\
else\l\
\ \ goto\ \<bb\ 6\>;\l\
}"];

    fn_0_basic_block_4 [shape=record,style=filled,fillcolor=lightgrey,label="{
FREQ:2769 |\<bb\ 4\>:\l\
|out_12\ =\ pop\ ();\l\
|if\ (out_12\ !=\ 0)\l\
\ \ goto\ \<bb\ 6\>;\l\
else\l\
\ \ goto\ \<bb\ 5\>;\l\
}"];

    fn_0_basic_block_5 [shape=record,style=filled,fillcolor=lightgrey,label="{
FREQ:2520 |\<bb\ 5\>:\l\
}"];

    fn_0_basic_block_6 [shape=record,style=filled,fillcolor=lightgrey,label="{
FREQ:9550 |\<bb\ 6\>:\l\
|#\ out_1\ =\ PHI\ \<out_12(4),\ out_12(5),\ out_2(3)\>\l\
|#\ iftmp.1_3\ =\ PHI\ \<1(4),\ 0(5),\ 0(3)\>\l\
|if\ (iftmp.1_3\ !=\ 0)\l\
\ \ goto\ \<bb\ 8\>;\l\
else\l\
\ \ goto\ \<bb\ 7\>;\l\
}"];

    fn_0_basic_block_8 [shape=record,style=filled,fillcolor=lightgrey,label="{
FREQ:880 |\<bb\ 8\>:\l\
|#\ _4\ =\ PHI\ \<out_1(6),\ 0(7)\>\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 |\<bb\ 5\>:\l\
|pop_first_bucket.2_10\ =\ pop_first_bucket;\l\
|if\ (pop_first_bucket.2_10\ !=\ 0)\l\
\ \ goto\ \<bb\ 3\>;\l\
else\l\
\ \ goto\ \<bb\ 6\>;\l\
}"];

    fn_0_basic_block_3 [shape=record,style=filled,fillcolor=lightgrey,label="{
FREQ:2769 |\<bb\ 3\>:\l\
|out_12\ =\ pop\ ();\l\
|if\ (out_12\ !=\ 0)\l\
\ \ goto\ \<bb\ 6\>;\l\
else\l\
\ \ goto\ \<bb\ 4\>;\l\
}"];

    fn_0_basic_block_4 [shape=record,style=filled,fillcolor=lightgrey,label="{
FREQ:2520 |\<bb\ 4\>:\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 |\<bb\ 2\>:\l\
goto\ \<bb\ 5\>;\l\
}"];

    fn_0_basic_block_6 [shape=record,style=filled,fillcolor=lightgrey,label="{
FREQ:880 |\<bb\ 6\>:\l\
|#\ _4\ =\ PHI\ \<out_12(3),\ 0(5)\>\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];
}
}

Reply via email to