Tool News
 
 
 

Tool News

Products Info
Downloads
Tools FAQs
RENESAS TOOL NEWS on December 16, 2004: RSO-M3T-NC308WA_1-041216D

A Note on Using the M3T-NC308WA and
M3T-NC30WA C-Compiler Packages

--On Evaluation of Elements of an Array
in the Controlling Expression of an If Statement--

Please take note of the following problem in using the M3T-NC308WA and M3T-NC30WA C-compiler packages:
  • On evaluation of Elements of an Array in the controlling expression of an if statement


  1. Products and Versions Concerned
    M3T-NC308WA V.3.10 Release 1 through V.5.10 Release 1
    (for the M32C/90, M32C/80 and M16C/80 series)

    M3T-NC30WA V.5.00 Release 1 and V.5.10 Release 1
    (for the M16C/60, M16C/30, M16C/Tiny, M16C/20, M16C/10, and R8C/Tiny series)


  2. Description
    If two or more expressions testing equality or inequality between an element of an array and a constant exist in the controlling expression of an if statement, incorrect code is generated.


  3. Conditions
    This problem occurs if the following conditions are all satisfied:
    (1)Two or more expressions testing equality or inequality between an element of an array and a constant exist in the controlling expression of an if statement.
    (2)The array in (1) is of type unsigned char or signed char.
    (3)The subscripts to the elements of the array in (1) are continuous numbers.
    (4)All the equality/inequality-testing expressions in (1) are associated with one another using the logical OR operators.
    (5)Compile option -O4 or -O5 is used; or any of those, -O1, -O2, -O3, -OR, and -OS, is used with -Ocompare_byte_to_word (-OCBTW).

    Example:
    -------------------------------------------------------------------------
    int  i;
    char    c[10];                           /* Conditions (2) and (3) */
    
    void    func(void)
    {
         if( c[0] == 0x1 || c[1] == 0x0 )    /* Conditions (1) and (4) */
                 i = 1;
         else
                 i = 0;
    }
    -------------------------------------------------------------------------


  4. Workaround
    This problem can be circumvented either of the following ways:
    (1) If compile option -O4 or -O5 used, don't associate the equality/inequality-testing expressions with one another using the logical OR operators; that is, separate them individually.
    Example:
    -----------------------------------------------------------------------
    int  i;
    char    c[10];
    
    void    func(void)
    {
         if( c[0] == 0x1 )
                 i = 1;
         else if( c[1] == 0x0 )
                 i = 1;
         else
                 i = 0;
    }
    -----------------------------------------------------------------------
    (2) If any of the compile options -O1, -O2, -O3, -OR, and -OS is selected with -OCBTW, deselect -OCBTW.


  5. Schedule of Fixing the Problem
    This problem has already been resolved in the V.5.20 Release 1 and later of both the M3T-NC308WA and M3T-NC30WA. So upgrade yours to these online from Software download for tools.





© 2008. Renesas Technology Corp., All rights reserved. Privacy | Legal