Since effort has been made on the original fix and the bug-case is not that
big to affect the analyse , I will still use the original bug-case.
Source:
typedef short int int16_t;
typedef int int32_t;
typedef unsigned char uint8_t;
typedef unsigned int uint32_t;
typedef unsigned long int uint64_t;
int32_t g_46 = 0L;
int32_t g_71 = 0L;
int32_t *g_311 = &g_46;
int32_t * func_19(int32_t * p_20, int16_t p_21, int32_t * p_22, const
uint8_t
p_23, int32_t * p_24) {
int32_t **l_426 = &g_311;
const uint64_t l_440 = 0x2A1DFCF9L;
for (p_21 = (-24);
(p_21 < 1);
p_21 = safe_add_func_int16_t_s_s(p_21, 3)) {
int32_t ***l_428 = &l_426;
(*l_428) = &g_311;
if ((*p_20)) {
if (l_440) {
}
else {
uint32_t l_445 = 4U;
if ((*g_311)) {
if ((safe_rshift_func_uint16_t_u_s(func_124((&p_22 !=
&p_24)), 10))) {
(*g_311) |= l_445;
(**l_426) |= (*p_24);
g_311 = &g_71;
}
}
}
}
}
}
the full seg fault backtrace:
#0 0xf7bb1fca in CHAIN::Tail (this=0x64) at
/fc/home/yug/open64/osprey/be/com/cxx_base.h:834
#1 0xf6f17035 in STMT_LIST::Tail (this=0x64) at
/fc/home/yug/open64/osprey/be/opt/opt_stmt.h:83
#2 0xf6f178e3 in BB_NODE::Last_stmtrep (this=0x0) at
/fc/home/yug/open64/osprey/be/opt/opt_bb.h:1595
#3 0xf6f146b9 in BB_NODE::Branch_stmtrep (this=0x0) at
/fc/home/yug/open64/osprey/be/opt/opt_bb.cxx:863
#4 0xf6fb4569 in DCE::Mark_block_live (this=0xffffc674, bb=0x8101528) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:3450
#5 0xf6fb44b9 in DCE::Mark_statement_live (this=0xffffc674,
stmt=0x80f8200) at /fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:3384
#6 0xf6fb3ad9 in DCE::Mark_coderep_live (this=0xffffc674, cr=0x80f82b8) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2641
#7 0xf6fb435b in DCE::Mark_statement_live (this=0xffffc674,
stmt=0x80f8360) at /fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:3356
#8 0xf6fb3ad9 in DCE::Mark_coderep_live (this=0xffffc674, cr=0x80f83a0) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2641
#9 0xf6fb3b28 in DCE::Mark_coderep_live (this=0xffffc674, cr=0x80f8418) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2650
#10 0xf6fb3d78 in DCE::Mark_coderep_live (this=0xffffc674, cr=0x80f84d0) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2725
#11 0xf6fb435b in DCE::Mark_statement_live (this=0xffffc674,
stmt=0x80f83d8) at /fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:3356
#12 0xf6fb3ad9 in DCE::Mark_coderep_live (this=0xffffc674, cr=0x80f8508) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2641
#13 0xf6fb41d4 in DCE::Mark_statement_live (this=0xffffc674,
stmt=0x80f8780) at /fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:3289
#14 0xf6fb3ad9 in DCE::Mark_coderep_live (this=0xffffc674, cr=0x81056f0) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2641
#15 0xf6fb401b in DCE::Mark_chinode_live (this=0xffffc674, chi=0x81070a8,
def_stmt=0x8105528)
at /fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2428
#16 0xf6fb39db in DCE::Mark_coderep_live (this=0xffffc674, cr=0x81056b8) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2615
#17 0xf6fb4a5e in DCE::Mark_phinode_live (this=0xffffc674, phi=0x8104b60,
visit_opnds=1)
at /fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2365
#18 0xf6fb38fd in DCE::Mark_coderep_live (this=0xffffc674, cr=0x8106170) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2594
#19 0xf6fb4a5e in DCE::Mark_phinode_live (this=0xffffc674, phi=0x8104c00,
visit_opnds=1)
at /fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2365
#20 0xf6fb38fd in DCE::Mark_coderep_live (this=0xffffc674, cr=0x80f8be8) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2594
#21 0xf6fb4a5e in DCE::Mark_phinode_live (this=0xffffc674, phi=0x8104c28,
visit_opnds=1)
at /fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2365
#22 0xf6fb38fd in DCE::Mark_coderep_live (this=0xffffc674, cr=0x80f79b8) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2594
#23 0xf6fb5167 in DCE::Mark_sr_munode_live (this=0xffffc674, sr=0x80f7a98)
at /fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2566
#24 0xf6fb4483 in DCE::Mark_statement_live (this=0xffffc674,
stmt=0x80f7a98) at /fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:3379
#25 0xf6fb3ad9 in DCE::Mark_coderep_live (this=0xffffc674, cr=0x80f7c00) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2641
#26 0xf6fb4a5e in DCE::Mark_phinode_live (this=0xffffc674, phi=0x8105088,
visit_opnds=1)
at /fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2365
#27 0xf6fb38fd in DCE::Mark_coderep_live (this=0xffffc674, cr=0x81061e0) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2594
#28 0xf6fb4a5e in DCE::Mark_phinode_live (this=0xffffc674, phi=0x8105100,
visit_opnds=1)
at /fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2365
#29 0xf6fb38fd in DCE::Mark_coderep_live (this=0xffffc674, cr=0x80f8c20) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2594
#30 0xf6fb4a5e in DCE::Mark_phinode_live (this=0xffffc674, phi=0x8105128,
visit_opnds=1)
at /fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2365
#31 0xf6fb38fd in DCE::Mark_coderep_live (this=0xffffc674, cr=0x80f79f0) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2594
#32 0xf6fb401b in DCE::Mark_chinode_live (this=0xffffc674, chi=0x8106f38,
def_stmt=0x80f7a98)
at /fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2428
#33 0xf6fb39db in DCE::Mark_coderep_live (this=0xffffc674, cr=0x80f7c00) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2615
#34 0xf6fb435b in DCE::Mark_statement_live (this=0xffffc674,
stmt=0x80f7ca8) at /fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:3356
#35 0xf6fb3ad9 in DCE::Mark_coderep_live (this=0xffffc674, cr=0x80f7ce8) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2641
#36 0xf6fb3d78 in DCE::Mark_coderep_live (this=0xffffc674, cr=0x80f7e18) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2725
#37 0xf6fb3d78 in DCE::Mark_coderep_live (this=0xffffc674, cr=0x80f7e50) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2725
#38 0xf6fb435b in DCE::Mark_statement_live (this=0xffffc674,
stmt=0x80f7dd8) at /fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:3356
#39 0xf6fb45a5 in DCE::Mark_block_live (this=0xffffc674, bb=0x8100c98) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:3452
#40 0xf6fb4954 in DCE::Mark_phinode_live (this=0xffffc674, phi=0x8105420,
visit_opnds=1)
at /fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2341
#41 0xf6fb38fd in DCE::Mark_coderep_live (this=0xffffc674, cr=0x8106250) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2594
#42 0xf6fb401b in DCE::Mark_chinode_live (this=0xffffc674, chi=0x8106b98,
def_stmt=0x80f7850)
at /fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2428
#43 0xf6fb39db in DCE::Mark_coderep_live (this=0xffffc674, cr=0x80f78c8) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2615
#44 0xf6fb375a in DCE::Mark_cr_munode_live (this=0xffffc674, cr=0x80f7940)
at /fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2506
#45 0xf6fb3c5c in DCE::Mark_coderep_live (this=0xffffc674, cr=0x80f7940) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2680
#46 0xf6fb3d78 in DCE::Mark_coderep_live (this=0xffffc674, cr=0x80f7980) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2725
#47 0xf6fb435b in DCE::Mark_statement_live (this=0xffffc674,
stmt=0x80f7900) at /fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:3356
#48 0xf6fb45a5 in DCE::Mark_block_live (this=0xffffc674, bb=0x81011c8) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:3452
#49 0xf6fb4954 in DCE::Mark_phinode_live (this=0xffffc674, phi=0x8104de0,
visit_opnds=1)
at /fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2341
#50 0xf6fb9548 in DCE::Find_required_statements (this=0xffffc674) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:4614
#51 0xf6fba499 in DCE::Dead_store_elim (this=0xffffc674) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:5153
#52 0xf6fbbebc in COMP_UNIT::Do_dead_code_elim (this=0x80e0500,
do_unreachable=1, do_dce_global=1, do_dce_alias=1, do_agg_dce=1,
do_identity_removal=1, do_preg_renumbering=0, paths_removed=0x0) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:5215
#53 0xf7093cb6 in Pre_Optimizer (phase=4, wn_tree=0xf7968330,
du_mgr=0x80cea30, alias_mgr=0x80ce9f0)
at /fc/home/yug/open64/osprey/be/opt/opt_main.cxx:1657
#54 0xf714e106 in Perform_Global_Optimization (pu_wn=0xf7968330,
region_wn=0xf7968330, alias_mgr=0x80ce9f0)
at /fc/home/yug/open64/osprey/be/opt/wodriver.cxx:156
#55 0x08052ae4 in WOPT_Processing (current_pu=0x80bdb98, pu=0xf7968330,
rgn_iter=0xffffcc1c, rwn=0xf7968330)
at
/fc/proj/ctires/open64/o64guru/src/Sun/trunk/osprey/be/be/driver.cxx:1012
#56 0x08053de1 in Do_WOPT_and_CG_with_Regions (current_pu=0x80bdb98,
pu=0xf7968330)
at
/fc/proj/ctires/open64/o64guru/src/Sun/trunk/osprey/be/be/driver.cxx:1134
#57 0x08054a29 in Backend_Processing (current_pu=0x80bdb98, pu=0xf7968330)
at
/fc/proj/ctires/open64/o64guru/src/Sun/trunk/osprey/be/be/driver.cxx:1555
#58 0x08055764 in Preorder_Process_PUs (current_pu=0x80bdb98) at
/fc/proj/ctires/open64/o64guru/src/Sun/trunk/osprey/be/be/driver.cxx:1975
#59 0x080569f6 in main (argc=27, argv=0xffffce94) at
/fc/proj/ctires/open64/o64guru/src/Sun/trunk/osprey/be/be/driver.cxx:2322
1) where the seg fault happened?
look at frame 52
#52 0xf6fbbebc in COMP_UNIT::Do_dead_code_elim (this=0x80e0500,
do_unreachable=1, do_dce_global=1, do_dce_alias=1, do_agg_dce=1,
do_identity_removal=1, do_preg_renumbering=0, paths_removed=0x0) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:5215
the source code:
5201 dce.Set_phase_unreachable();
5202 unreachable = dce.Unreachable_code_elim();
5203
5204 if ( unreachable ) {
5205 Cfg()->Invalidate_and_update_aux_info(TRUE);
5206 }
5207 }
5208
5209 if ( dce.Tracing() ) {
5210 fprintf( TFile, "%sDead_store_elim\n%s", SBar, SBar );
5211 }
5212
5213 dce.Set_phase_dead_store();
5214 dce.Init_return_vsym();
5215 unreachable = dce.Dead_store_elim();
we can make sure dce happened at dce.Dead_store_elim, and the
dce.Unreachable_code_elim has been previously performed.
from the source code
if (l_440) {
}
else {
uint32_t l_445 = 4U;
if ((*g_311)) {
if
((safe_rshift_func_uint16_t_u_s(func_124((&p_22 !=
&p_24)), 10))) {
(*g_311) |= l_445;
(**l_426) |= (*p_24);
g_311 = &g_71;
}
}
}
and l_440 is defined as
const uint64_t l_440 = 0x2A1DFCF9L;
So, we can make sure at this phase, "else {...}" including the block and
statements has been removed by DCE.
2.) the seg fault control is in the wrong path.
look at frame 13
#13 0xf6fb41d4 in DCE::Mark_statement_live (this=0xffffc674,
stmt=0x80f8780) at /fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:3289
the stmt 0x80f8780 is:
> LDID U8 U8 sym10v10 0 ty=3503 <u=2 cr87> flags:0x12 b=-1 #g_311
> U4U4ILOAD 0 ty=802 <u=8191 cr96> flags:0x0 b=-1 mu<23/cr90>
> LDC U4 4 <u=0 cr69> flags:0x0 b=-1
> U4BIOR <u=0 cr97> isop_flags:0xc0000 flags:0x1 b=-1
> LDID U8 U8 sym10v10 0 ty=3503 <u=2 cr87> flags:0x12 b=-1 #g_311
>OPR_ISTORE I4 0 <u=0 cr98> b=-1 flags:0x12 pj2 Sid-1
chi <10/cr101/cr87 14/cr10/cr10 22/cr99/cr89 23/cr100/cr90 > 0x0x80f8780
i.e, " (*g_311) |= l_445;", this is already removed at the
unreachable_code_elim phase.
why mark a dead-stmt live? we can make sure dce is start doing things
unexpected.
3). where is unexpected?
look at frame 14.
#14 0xf6fb3ad9 in DCE::Mark_coderep_live (this=0xffffc674, cr=0x81056f0) at
/fc/home/yug/open64/osprey/be/opt/opt_dce.cxx:2641
the cr can be dumped as:
>LDID U8 U8 sym10v0 0 ty=903 <u=0 cr8> flags:0x82 b=-1 #g_311
the cr's Defstmt can be dumped as:
> LDID U8 U8 sym10v10 0 ty=3503 <u=2 cr87> flags:0x12 b=-1 #g_311
> U4U4ILOAD 0 ty=802 <u=8191 cr96> flags:0x0 b=-1 mu<23/cr90>
> LDC U4 4 <u=0 cr69> flags:0x0 b=-1
> U4BIOR <u=0 cr97> isop_flags:0xc0000 flags:0x1 b=-1
> LDID U8 U8 sym10v10 0 ty=3503 <u=2 cr87> flags:0x12 b=-1 #g_311
>OPR_ISTORE I4 0 <u=0 cr98> b=-1 flags:0x12 pj2 Sid-1
chi <10/cr101/cr87 14/cr10/cr10 22/cr99/cr89 23/cr100/cr90 > 0x0x80f8780
i.e, " (*g_311) |= l_445;", this is correct, since at opt_htable.cxx
iload_folded(opt_htable.cxx:2914)
cr8's define statement is setted to this stmt .
The DCE source code shows
2622 if ( cr->Defstmt() != NULL && !cr->Defstmt()->Live_stmt() ) {
2623 // if we're making this statement live just because it's
2624 // associated with a chi, see if we can get rid of "i = i"
2625 // assignments. This only happens when zero-version is
2626 // enabled because we won't otherwise make the chi live
2627 // by default.
2628 BOOL make_live = TRUE;
...
cr->Defstmt() should not be marked NON_live, so the control will not follow
wrong path.
4) what do the unexpected.
721void
722BB_NODE::Remove_stmtrep( STMTREP *stmt )
723{
...
735 _stmtlist.Remove(stmt);
736 stmt->Reset_live_stmt(); // WHIRL SSA: mark stmt dead
737}
when removing the stmtrep, we unexpected reset live_stmt,
which makes dce believe the deleted stmtrep is one to recover. The, the
control follows the wrong path.
Sun, let me know if you still have questions.
Regards
Gang
------------------------------------------------------------------------------
Learn Windows Azure Live! Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for
developers. It will provide a great way to learn Windows Azure and what it
provides. You can attend the event by watching it streamed LIVE online.
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel