Hi all,

Can gatekeeper help review this fix?

The problem is that, it’s not appropriate to use a char* to record a
string recorded in STR table, because memory area of STR table could
change when it enlarge itself. We should use STR table index instead.

Those code from LOONGSON is almost right, except it has no need to
copy the string.

Index: osprey/be/cg/cgemit.cxx
===================================================================
--- osprey/be/cg/cgemit.cxx       (revision 3503)
+++ osprey/be/cg/cgemit.cxx    (working copy)
@@ -8377,12 +8377,7 @@
static Dwarf_Unsigned  prev_pu_base_elfsym = 0;
static PU_IDX          prev_pu_pu_idx      = (PU_IDX) 0;
static Dwarf_Unsigned  prev_pu_end_offset_from_last_label = 0;
-#ifdef TARG_LOONGSON
- /* We'd better use str_idx, not the str itself to avoid access
trouble after alloc*/
 static STR_IDX  prev_pu_last_label_name_idx = 0;
-#else
-static char           *prev_pu_last_label_name = NULL;
-#endif
static Dwarf_Unsigned  prev_pu_last_offset = 0;

 static void
@@ -8395,11 +8390,7 @@
   prev_pu_base_elfsym = base_elf_idx;
   prev_pu_pu_idx      = pu_idx;
   prev_pu_end_offset_from_last_label = end_offset;
-#ifdef TARG_LOONGSON
-  prev_pu_last_label_name_idx = Save_Str(LABEL_name(label_idx));
-#else
-  prev_pu_last_label_name = LABEL_name(label_idx);
-#endif
+  prev_pu_last_label_name_idx = LABEL_name_idx(label_idx);
   prev_pu_last_offset = Get_Label_Offset(label_idx);
}

Thanks
zhuqing

------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to