looks good to me Sun On Wed, Dec 22, 2010 at 6:42 AM, Min Zhao <mzhao...@gmail.com> wrote: > Hi, > > Would a gatekeeper please review my fix for bug629? > > https://bugs.open64.net/show_bug.cgi?id=629 > > > > The assertion happens in opt_htable.h (#981), because Const_val expects a > CK_CONST. > > > > The root cause for the problem is inside the simplifier (wn_simp_code.h). > Inside SIMPNODE_SimplifyExp2_h, SIMP_Is_Constant is used to detect whether > k1 is a constant or not. For example, > > 5754 k0const = SIMP_Is_Constant(k0); > > 5755 k1const = SIMP_Is_Constant(k1); > > SIMP_Is_Constant was enhanced to return true for string constant as well. > > > > While in the simplifying functions (e.g., simp_bxor, simp_bior), only > int_const is expected. For example, > > 4040 if (k1const) { > > 4041 c1 = SIMP_Int_ConstVal(k1); > > 4042 ... > > When k1 is a str constant, the assertion happens. > > > > My fix is to add a function, SIMP_Int_Str_ConstVal, to handle both int and > string constant case. The uses of SIMP_Int_ConstVal inside simplifying > functions are changed to SIMP_Int_Str_ConstVal. > > > Thanks, > > > > Min > > > > Index: wn_simp_code.h > > =================================================================== > > --- wn_simp_code.h (revision 3444) > > +++ wn_simp_code.h (working copy) > > @@ -530,6 +530,16 @@ > > } > > #endif // KEY > > > > +inline INT64 SIMP_Int_Str_ConstVal(simpnode x) > > +{ > > + if (SIMP_Is_Int_Constant (x)) > > + return SIMP_Int_ConstVal(x); > > + else if (SIMP_Is_Str_Constant (x)) > > + return Targ_To_Host(SIMP_Str_ConstVal(x)); > > + else > > + Fail_FmtAssertion("Not a int/str constant"); > > +} > > + > > #define IS_POWER_OF_2(x) (((x)!=0) && ((x) & ((x)-1))==0) > > > > /* Utility routine to create a 64 bit number with from 0 to 64 bits in it. > > @@ -3644,7 +3654,7 @@ > > ty = OPCODE_rtype(opc); > > > > if (k1const) { > > - c1 = SIMP_Int_ConstVal(k1); > > + c1 = SIMP_Int_Str_ConstVal(k1); > > if (c1 == 0) { > > SHOW_RULE("j&0"); > > r = SIMP_INTCONST(ty,0); > > @@ -3803,18 +3813,8 @@ > > ty = OPCODE_rtype(opc); > > > > if (k1const) { > > -#ifdef TARG_IA64 > > - if (SIMP_Is_Int_Constant (k1)) { > > - c1 = SIMP_Int_ConstVal(k1); > > - } else if (SIMP_Is_Str_Constant (k1)) { > > - c1 = Targ_To_Host (SIMP_Str_ConstVal (k1)); > > - } else { > > - Fail_FmtAssertion ("Not a int/str constant"); > > - } > > -#else > > - c1 = SIMP_Int_ConstVal(k1); > > -#endif > > - if (c1 == 0) { > > + c1 = SIMP_Int_Str_ConstVal(k1); > > + if (c1 == 0) { > > SHOW_RULE("j|0"); > > r = k0; > > SIMP_DELETE(k1); > > @@ -4038,7 +4038,7 @@ > > ty = OPCODE_rtype(opc); > > > > if (k1const) { > > - c1 = SIMP_Int_ConstVal(k1); > > + c1 = SIMP_Int_Str_ConstVal(k1); > > if (c1 == 0) { > > SHOW_RULE("j^0"); > > r = k0; > > @@ -4123,7 +4123,7 @@ > > ty = OPCODE_rtype(opc); > > > > if (k1const) { > > - c1 = SIMP_Int_ConstVal(k1); > > + c1 = SIMP_Int_Str_ConstVal(k1); > > if (c1 == 0) { > > SHOW_RULE(" j&&0"); > > r = SIMP_INTCONST(ty,0); > > @@ -4195,7 +4195,7 @@ > > ty = OPCODE_rtype(opc); > > > > if (k1const) { > > - c1 = SIMP_Int_ConstVal(k1); > > + c1 = SIMP_Int_Str_ConstVal(k1); > > if (c1 == 0) { > > SHOW_RULE("j||0"); > > r = k0; > > @@ -4253,7 +4253,7 @@ > > INT64 c1; > > > > if (k0const) { > > - c1 = SIMP_Int_ConstVal(k0); > > + c1 = SIMP_Int_Str_ConstVal(k0); > > if (c1 == 0) { > > SHOW_RULE(" 0 c&& j"); > > r = SIMP_INTCONST(OPCODE_rtype(opc),0); > > @@ -4265,7 +4265,7 @@ > > SIMP_DELETE(k0); > > } > > } else if (k1const) { > > - c1 = SIMP_Int_ConstVal(k1); > > + c1 = SIMP_Int_Str_ConstVal(k1); > > if (c1 != 0) { > > SHOW_RULE(" j c&& 1"); > > r = k0; > > @@ -4311,7 +4311,7 @@ > > #endif > > > > if (k0const) { > > - c1 = SIMP_Int_ConstVal(k0); > > + c1 = SIMP_Int_Str_ConstVal(k0); > > if (c1 == 0) { > > SHOW_RULE("0 c|| j"); > > r = k1; > > @@ -4323,7 +4323,7 @@ > > SIMP_DELETE_TREE(k1); > > } > > } else if (k1const) { > > - c1 = SIMP_Int_ConstVal(k1); > > + c1 = SIMP_Int_Str_ConstVal(k1); > > if (c1 == 0) { > > SHOW_RULE("j c|| 0"); > > r = k0; > > ------------------------------------------------------------------------------ > Forrester recently released a report on the Return on Investment (ROI) of > Google Apps. They found a 300% ROI, 38%-56% cost savings, and break-even > within 7 months. Over 3 million businesses have gone Google with Google > Apps: > an online email calendar, and document program that's accessible from your > browser. Read the Forrester report: http://p.sf.net/sfu/googleapps-sfnew > _______________________________________________ > Open64-devel mailing list > Open64-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/open64-devel > >
------------------------------------------------------------------------------ Forrester recently released a report on the Return on Investment (ROI) of Google Apps. They found a 300% ROI, 38%-56% cost savings, and break-even within 7 months. Over 3 million businesses have gone Google with Google Apps: an online email calendar, and document program that's accessible from your browser. Read the Forrester report: http://p.sf.net/sfu/googleapps-sfnew _______________________________________________ Open64-devel mailing list Open64-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open64-devel