It is not easy to see there is a fall-thru unless one has a sharp eye. In general, people do not expect switch cases to fall thru. A convention that is widely followed in Open64 is to alert the reader by adding:

/* fall thru */

at the end of the switch case before the case label that it is falling thru to. This will make the logic stands out more clearly and helps in maintenance. There is already example of this in the files you're modifying.

Fred

On 04/29/2011 07:19 AM, Hui Shi wrote:
Hi Fred,

if (((mINT32)TCON_v0(*tc)) >= 0), it will not break out of switch and fall through code to check v1, v2, v3 be zero.
    case MTYPE_U1:
    case MTYPE_U2:
    case MTYPE_U4:
    case MTYPE_F4:
     Is_True ( (TCON_v1(*tc)|TCON_v2(*tc)|TCON_v3(*tc)) == 0,
           ("High order word of %s TCON non zero %x",
        Mtype_Name(TCON_ty(*tc)), TCON_v1(*tc)) );


On Fri, Apr 29, 2011 at 6:50 PM, Fred Chow <frdc...@gmail.com <mailto:frdc...@gmail.com>> wrote:

    Hi Hui,

    This version will not apply assertion if (((mINT32)TCON_v0(*tc))
    >= 0), so will only have half as much assertion coverage as what
    the original code intended.

    Fred


    On 04/28/2011 08:09 PM, Hui Shi wrote:

    Would a gatekeeper help review?
    I have update the patch with new error message in attachment.


    On Thu, Apr 28, 2011 at 1:30 PM, Hui Shi <kalin....@gmail.com
    <mailto:kalin....@gmail.com>> wrote:

        you're right.

        I'll change message to "TCON_v1 not-sign extend result or
        High order word of %s TCON non zero"


        On Thu, Apr 28, 2011 at 1:26 PM, Yiran Wang
        <yiran.w...@gmail.com <mailto:yiran.w...@gmail.com>> wrote:

            I think it is good to improve the message, as we allow
            all 1s and all 0s.

            Regards,
            yiran

            On Thu, Apr 28, 2011 at 1:09 PM, Hui Shi
            <kalin....@gmail.com <mailto:kalin....@gmail.com>> wrote:


                Would gatekeeper help review this fix?

                I1,I2,I4 will be sign extend to I8 and store in TCON_I8,
                So when I1,I2,I4 is negative, TCON_V1 can be
                0xffffffff. So the following assertion condition is
                not correct.

                     Is_True (
                (TCON_v1(*tc)|TCON_v2(*tc)|TCON_v3(*tc)) == 0,
                           ("High order word of %s TCON non zero %x",
                        Mtype_Name(TCON_ty(*tc)), TCON_v1(*tc)) );
                     break;

                Fix is for I1,I2,I4 tcon value, assert if TCON_v0 is
                negative, TCON_V1 is 0xffffffff.
                     case MTYPE_I1:
                     case MTYPE_I2:
                     case MTYPE_I4:
                +      // since I1/I2/I4 is negative and sign extend
                to I8
                +      // then store to TCON, tcon_v1 wil be 0xffffffff
                +      if (((mINT32)TCON_v0(*tc)) < 0) {
                +        Is_True ( ((mINT32)TCON_v1(*tc) ==
                ((mINT32)-1)) &&
                +                 ((TCON_v2(*tc)|TCON_v3(*tc)) == 0),
                +           ("High order word of %s TCON non zero %x",
                +          Mtype_Name(TCON_ty(*tc)), TCON_v1(*tc)) );
                +        break;
                +      }
                     case MTYPE_U1:
                     case MTYPE_U2:
                     case MTYPE_U4:

                Regards
                Shi Hui

                
------------------------------------------------------------------------------
                WhatsUp Gold - Download Free Network Management Software
                The most intuitive, comprehensive, and cost-effective
                network
                management toolset available today.  Delivers lowest
                initial
                acquisition cost and overall TCO of any competing
                solution.
                http://p.sf.net/sfu/whatsupgold-sd
                _______________________________________________
                Open64-devel mailing list
                Open64-devel@lists.sourceforge.net
                <mailto:Open64-devel@lists.sourceforge.net>
                https://lists.sourceforge.net/lists/listinfo/open64-devel





    
------------------------------------------------------------------------------
    WhatsUp Gold - Download Free Network Management Software
    The most intuitive, comprehensive, and cost-effective network
    management toolset available today.  Delivers lowest initial
    acquisition cost and overall TCO of any competing solution.
    http://p.sf.net/sfu/whatsupgold-sd


    _______________________________________________
    Open64-devel mailing list
    Open64-devel@lists.sourceforge.net  
<mailto:Open64-devel@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/open64-devel



------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to