Author: xiaohua_zhang Date: 2010-09-13 15:57:48 -0400 (Mon, 13 Sep 2010) New Revision: 3340
Modified: trunk/osprey/common/com/mtypes.cxx trunk/osprey/common/com/mtypes.h trunk/osprey/wgen/wgen_decl.cxx Log: Bug 592: Assertion failure in file: osprey/../libspin/gspin-tel.h, function: gs_tree_value, line: 947 It happens when the initializer list for vector typed variable is empty. The code used to get the element type from initializer, when it is empty, the code gets a null pointer access. Now it is changed to use the vector MTYPE to get its element type. __attribute__ ((vector_size (sizeof (double) * 4))) double d1 = { 1., 2 }; __attribute__ ((vector_size (sizeof (double) * 4))) double d2 = { }; __attribute__ ((vector_size (sizeof (float) * 4))) float f1 = { 1., 2 }; __attribute__ ((vector_size (sizeof (float) * 4))) float f2 = { }; __attribute__ ((vector_size (sizeof (int) * 4))) int a = { 1, 2 }; __attribute__ ((vector_size (sizeof (int) * 4))) int c = { }; Code Review: JianXin Lai Modified: trunk/osprey/common/com/mtypes.cxx =================================================================== --- trunk/osprey/common/com/mtypes.cxx 2010-09-13 06:07:31 UTC (rev 3339) +++ trunk/osprey/common/com/mtypes.cxx 2010-09-13 19:57:48 UTC (rev 3340) @@ -482,7 +482,6 @@ return Machine_Prev_Alignment[type]; } -#if defined(TARG_X8664) /* ==================================================================== * * TYPE_ID Mtype_vector_elemtype(TYPE_ID) @@ -494,6 +493,7 @@ TYPE_ID Mtype_vector_elemtype(TYPE_ID type) { switch (type) { +#if defined(TARG_X8664) case MTYPE_V32F8: case MTYPE_V16F8: return MTYPE_F8; @@ -526,9 +526,9 @@ case MTYPE_V8I1: case MTYPE_M8I1: return MTYPE_I1; +#endif default: return type; } } -#endif Modified: trunk/osprey/common/com/mtypes.h =================================================================== --- trunk/osprey/common/com/mtypes.h 2010-09-13 06:07:31 UTC (rev 3339) +++ trunk/osprey/common/com/mtypes.h 2010-09-13 19:57:48 UTC (rev 3340) @@ -317,9 +317,7 @@ extern TYPE_ID Mtype_next_alignment( TYPE_ID); extern TYPE_ID Mtype_prev_alignment( TYPE_ID); -#if defined (TARG_X8664) extern TYPE_ID Mtype_vector_elemtype( TYPE_ID); -#endif #ifdef __cplusplus } Modified: trunk/osprey/wgen/wgen_decl.cxx =================================================================== --- trunk/osprey/wgen/wgen_decl.cxx 2010-09-13 06:07:31 UTC (rev 3339) +++ trunk/osprey/wgen/wgen_decl.cxx 2010-09-13 19:57:48 UTC (rev 3340) @@ -2351,13 +2351,14 @@ init = gs_tree_vector_cst_elts (init_list); - gs_t size = gs_type_size (gs_tree_type (gs_tree_value (init))); - Is_True (gs_tree_code (size) == GS_INTEGER_CST, - ("WGEN_Add_Aggregate_Init_Vector: Vector of variable-sized units?")); - - UINT esize = gs_get_integer_value(size) / BITSPERBYTE; + // find the element size from vector mtype + TY_IDX vector_type = Get_TY(gs_tree_type(init_list)); + Is_True (MTYPE_is_vector(TY_mtype(vector_type)), + ("WGEN_Add_Aggregate_Init_Vector: invalid vector type")); + TYPE_ID elem_mtype = Mtype_vector_elemtype(TY_mtype(vector_type)); + UINT esize = MTYPE_byte_size(elem_mtype); UINT nunits = vec_size / esize; - gs_code_t code = gs_tree_code (gs_tree_value (init)); + gs_code_t code = MTYPE_is_integral(elem_mtype) ? GS_INTEGER_CST : GS_REAL_CST; for (i = 0; init; ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ Open64-devel mailing list Open64-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open64-devel