[Open64-devel] Please revew a patch about ipa dst merge
Brought to you by:
ributzka,
suneeljain
From: shenrfen <she...@gm...> - 2012-04-28 16:03:28
|
Hi, all. I found a bug about IPA dst merge. Could you please give a review? Thx very much. Test case: 1.c extern void foo(int a); int main() { foo(135); } 2.c extern void goo(int a); void foo(int a) { goo(a); } 3.c int goo(int a) { printf("a= %d\n", a); } Command: opencc 1.c 2.c 3.c -IPA:dst=1 -ipa -keep Error: opencc INTERNAL ERROR: /home/rfshen/workspace/build_trunk_x86/x86_bin//lib/gcc-lib/x86_64-open64-li nux/5.0/ipa_link died due to signal 11 The following is the backtrace. 0x0061ee6a in DST_enter_inlined_subroutine (parent= {byte_idx = 40, block_idx = 3}, inl_routine= {byte_idx = 40, block_idx = 4}, begin_label=0, end_label=0, caller_file_dst=0x9c31af8, callee_file_dst=0x9c31b20, symtab=0xa1a7e50, caller_file_m=0xa1b1070, callee_file_m=0xa1b1110, cross_file_id=2) at /home/rfshen/workspace/build_trunk_x86/osprey/../../trunk/osprey/be/com/clon e_DST_utils.cxx:801 801 DST_SUBPROGRAM *inl_attr = DST_ATTR_IDX_TO_PTR(DST_INFO_attributes(DST_INFO_IDX_TO_PTR(abstract_origin) ), Here, abstract_origin = $1 = {byte_idx = -2, block_idx = -2} ============================================================================ =========== #0 0x0061ee6a in DST_enter_inlined_subroutine (parent= {byte_idx = 40, block_idx = 3}, inl_routine= {byte_idx = 40, block_idx = 4}, begin_label=0, end_label=0, caller_file_dst=0x9c31af8, callee_file_dst=0x9c31b20, symtab=0xa1a7e50, caller_file_m=0xa1b1070, callee_file_m=0xa1b1110, cross_file_id=2) at /home/rfshen/workspace/build_trunk_x86/osprey/../../trunk/osprey/be/com/clon e_DST_utils.cxx:801 #1 0x0061f7fd in DST_enter_cloned_childs (parent= {byte_idx = 40, block_idx = 3}, inl_routine= {byte_idx = 96, block_idx = 0}, symtab=0xa1a7e50, caller_file_dst=0x9c31af8, callee_file_dst=0x9c31b20, parent_file_index=2, inlined=1, caller_file_m=0xa1b1070, callee_file_m=0xa1b1110) at /home/rfshen/workspace/build_trunk_x86/osprey/../../trunk/osprey/be/com/clon e_DST_utils.cxx:415 #2 0x0061efcf in DST_enter_inlined_subroutine (parent= {byte_idx = 96, block_idx = 0}, inl_routine= {byte_idx = 96, block_idx = 0}, begin_label=0, end_label=0, caller_file_dst=0x9c31af8, callee_file_dst=0x9c31b20, symtab=0xa1a7e50, caller_file_m=0xa1b1070, callee_file_m=0xa1b1110, cross_file_id=2) at /home/rfshen/workspace/build_trunk_x86/osprey/../../trunk/osprey/be/com/clon e_DST_utils.cxx:827 #3 0x005e30a3 in IPO_INLINE::Process (this=0xbf9d1574) at /home/rfshen/workspace/build_trunk_x86/osprey/../../trunk/osprey/ipa/main/op timize/ipo_inline.cxx:4789 #4 0x005c1a11 in Inline_Call (caller=0xa1b1020, callee=0xa1b10c0, edge=0xa1b6028, cg=0x9c35eb0) I found that, when do "DST_mk_cross_inlined_subroutine", abstract_origin field is initialized with DST_FOREIGN_INIT <-2, -2> DST_INFO_IDX abstract_origin = DST_FOREIGN_INIT; In my opinion, abstract_origin should be same with the subroutine which is copied. So, I made the followed patch, Please give a review. Thx very much. Index: osprey/common/com/dwarf_DST_producer.cxx =================================================================== --- osprey/common/com/dwarf_DST_producer.cxx (revision 3906) +++ osprey/common/com/dwarf_DST_producer.cxx (working copy) @@ -694,7 +694,8 @@ UINT64 fmod_time, /* Last file mod time */ USRCPOS inl_decl, /* inline routine's source position */ char *filename, /* ptr to filename of the inlined routine */ - char *dirname) /* ptr to directory path of the inlined routine */ + char *dirname, /* ptr to directory path of the inlined routine */ + DST_INFO_IDX abstract_origin) /* The abstract version of this subroutine */ { DST_INFO_IDX info_idx; @@ -702,7 +703,6 @@ DST_flag flag = DST_no_flag; DST_INLINED_SUBROUTINE *attr; USRCPOS decl; /* source position */ - DST_INFO_IDX abstract_origin = DST_FOREIGN_INIT; mUINT16 file_id = 0; USRCPOS_clear(decl); Index: osprey/common/com/dwarf_DST_producer.h =================================================================== --- osprey/common/com/dwarf_DST_producer.h (revision 3906) +++ osprey/common/com/dwarf_DST_producer.h (working copy) @@ -720,7 +720,8 @@ UINT64 , USRCPOS , char *, - char *); + char *, + DST_INFO_IDX ); #endif #if defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER) || defined(_LEGO_CLONER) Index: osprey/be/com/clone_DST_utils.cxx =================================================================== --- osprey/be/com/clone_DST_utils.cxx (revision 3908) +++ osprey/be/com/clone_DST_utils.cxx (working copy) @@ -817,7 +817,8 @@ fmod_time, DST_SUBPROGRAM_decl_decl(attr), filename, - dirname); + dirname, + abstract_origin); DST_append_child(parent, idx); |