Re: errata/402: PROPOSAL - 9.5: evaluation of case expression

From: Steven Sharp (sharp@cadence.com)
Date: Mon Aug 11 2003 - 15:50:04 PDT

  • Next message: Michael McNamara: "RE: Comment on Issue 211"

    Precedence: bulk

    The following reply was made to PR errata/402; it has been noted by GNATS.

    From: Steven Sharp <sharp@cadence.com>
    To: etf-bugs@boyd.com, Brad.Pierce@synopsys.com
    Cc:
    Subject: Re: errata/402: PROPOSAL - 9.5: evaluation of case expression
    Date: Mon, 11 Aug 2003 18:41:00 -0400 (EDT)

     The situation where XL appears to re-evaluate the case expression is quite
     limited, and is due to a particular optimization. It only occurs if the
     case expression is an identifier. If it contains any operators, even ones
     that don't affect the value (e.g. {i}), then the expression only gets
     evaluated once. Even implicit operations, such as extending the width
     of the value to match a wider expression in one of the case item expressions,
     will ensure it is only evaluated once.
     
     It appears that this is an optimization that determines that the value of
     the expression is identical to the value of the identifier, and uses the
     value held in the identifier for the comparisons, to save making a copy.
     Applying this optimization in this situation, where other expressions
     will be evaluated and have side effects before this value is used, results
     in the behavior are seeing. This behavior is not intentional, and should
     be considered an obscure bug in XL.
     
     If XL is run with all optimizations turned off, this does not happen. The
     case expression is only evaluated once. Note that there are other situations
     in which XL changes behavior at different optimization levels. In these
     cases, turning off all optimizations gives the most consistent and "standard"
     behavior.
     
     So I think we can go ahead with the proposal.
     
     Steven Sharp
     sharp@cadence.com
     



    This archive was generated by hypermail 2.1.4 : Mon Aug 11 2003 - 15:51:02 PDT and
    sponsored by Boyd Technology, Inc.