Hi all,

Can gatekeeper help review this fix?

The problem is that for expr TY_kind(ST_type(blk)), the ty_idx for blk
is invalid if the sym_class is CLASS_FUNC or CLASS_BLOCK,CLASS_NAME.

svn diff for r3492:
Modified: trunk/osprey/be/com/data_layout.cxx
===================================================================
--- trunk/osprey/be/com/data_layout.cxx 2011-02-24 22:51:04 UTC (rev 3491)
+++ trunk/osprey/be/com/data_layout.cxx 2011-02-25 09:58:56 UTC (rev 3492)
@@ -652,7 +652,7 @@
  INT64 size;
  INITO_IDX ino_idx;
  // if blk is variable length struct, its size should be inito size.
-  if (TY_kind(ST_type(blk)) == KIND_STRUCT && (ino_idx =
Find_INITO_For_Symbol(blk)) != 0)
+  if (TY_kind(ST_type(blk)) == KIND_STRUCT && (ino_idx =
Find_INITO_For_Symbol(blk)) != 0 && INITV_kind(INITO_val(ino_idx)) ==
INITVKIND_BLOCK)
  {
    size = Get_INITO_Size(ino_idx);
    Is_True(size >= ST_size(blk),("%s's inito size smaller than
ST_size",ST_name(blk)));

Here is the case, may need to enlarge file number to reproduce:

n=1
while [ $n -lt 2500 ]
do
       echo "Processing $n"
       echo "void myfunc$n(){}" > file$n.c
       opencc -Ofast -c -o file$n.o file$n.c
       n=`expr $n + 1`

done

opencc -Ofast -shared -o a.so *.o

The fix is:
Index: be/com/data_layout.cxx
===================================================================
--- be/com/data_layout.cxx      (revision 3537)
+++ be/com/data_layout.cxx      (working copy)
@@ -652,7 +652,10 @@
   INT64 size;
   INITO_IDX ino_idx;
   // if blk is variable length struct, its size should be inito size.
-  if (TY_kind(ST_type(blk)) == KIND_STRUCT && (ino_idx =
Find_INITO_For_Symbol(blk)) != 0 && INITV_kind(INITO_val(ino_idx)) ==
INITVKIND_BLOCK)
+  if ( ST_class(blk) == CLASS_VAR &&
+       TY_kind(ST_type(blk)) == KIND_STRUCT &&
+       (ino_idx = Find_INITO_For_Symbol(blk)) != 0 &&
+       INITV_kind(INITO_val(ino_idx)) == INITVKIND_BLOCK )
   {
     size = Get_INITO_Size(ino_idx);
     Is_True(size >= ST_size(blk),("%s's inito size smaller than
ST_size",ST_name(blk)));

Thanks Michael Lai point out the issue and provide the case!

Thanks
zhuqing

------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to