Hi all,
Can gatekeeper help review following fix for bug833?
https://bugs.open64.net/show_bug.cgi?id=833
case:
struct in6_addr
{
unsigned char u6_addr8[16];
};
static const struct ip6addrlbl_init_table
{
const struct in6_addr *prefix;
int prefixlen;
} array_table =
{
.prefix = &(struct in6_addr){ 0xfc },
.prefixlen = 7,
};
int main()
{
printf("%x\n",*array_table.prefix);
}
The result should be 0xfc, but not Segmentation fault.
The problem is the initial for array_table is incorrect.
The creation of inito and initv is sequently, if there is an initial
in another initial, and need to set up a new st , the initv index is
increased in the new st initialize, when return from the new init_wn,
we should adjust the block index of the uplevel inito.
=======================================================================
INITOs:
[1]: array_table (0x3501):
BLOCK:
BLOCK: ==>
BLOCK: ==>
VAL: 252 ===> SYMOFF: .init(0x3601)+0(0x0)
PAD: 15 ==> VAL: 7
ENDBLOCK=> PAD: 4
ENDBLOCK==>
ENDBLOCK
[2]: .init (0x3601):
BLOCK:
BLOCK:
VAL: 252
PAD: 15
ENDBLOCK
ENDBLOCK
patch:
Index: osprey/wgen/wgen_decl.cxx
===================================================================
--- osprey/wgen/wgen_decl.cxx (revision 3714)
+++ osprey/wgen/wgen_decl.cxx (working copy)
@@ -2622,7 +2622,19 @@
WGEN_Get_LABEL (label_decl, FALSE);
WGEN_Add_Aggregate_Init_Label (label_idx);
}
- else Add_Init_For_WHIRL(init_wn, size, 0);
+ else {
+ Add_Init_For_WHIRL(init_wn, size, 0);
+ if (WN_has_sym(init_wn)) {
+ ST* st = WN_st(init_wn);
+ INITO_IDX idx = Find_INITO_For_Symbol(st);
+ if (idx != 0 &&
+ ST_initv_in_other_st(st) &&
+ idx > _inito ) {
+ INITO ino = Inito_Table[idx];
+ Set_INITV_blk(ino.val-1, _last_initv);
+ }
+ }
+ }
WN_DELETE_Tree (init_wn);
break;
}
Thanks
zhuqing
------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management
Up to 160% more powerful than alternatives and 25% more efficient.
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Open64-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/open64-devel