I tend to think you are right, except your stack trace is not helping me to
understand what the problem is.
Can you give a bit explanation that I can relate back to your test case?
Thx!
Sun

On Sun, Apr 29, 2012 at 12:02 AM, shenrfen <shenr...@gmail.com> wrote:

> 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-linux/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/clone_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/clone_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/clone_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/clone_DST_utils.cxx:827
> ****
>
> #3  0x005e30a3 in IPO_INLINE::Process (this=0xbf9d1574)****
>
>     at
> /home/rfshen/workspace/build_trunk_x86/osprey/../../trunk/osprey/ipa/main/optimize/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);****
>
> ** **
>
> ** **
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to