Tool News
 
 
 

Tool News

Products Info
Downloads
Tools FAQs
MESC TOOL NEWS: MESCT-NC30WA_2-981001D

NC30WA, NC30
Precautions

Please take note of the following problems in using C compilers NC30WA and NC30 for the M16C/60 series of microcomputers. You are kindly requested to circumvent these problems by the workarounds described below.


Versions Concerned
NC30WA and NC30 V.1.00 Release 1 to V.3.00 Release 2 affected.


Problem 1. On Arguments of Functions
  1. Description
    Defining a function to take arguments with the same name may result in incorrect code being generated.

  2. Conditions
    This problem occurs if the following three conditions are satisfied:
    1. A function is passed to a register.
    2. To obtain an argument described in 1 above, another function with the same name is called.
    3. The above function call is described as the first argument of the function in condition (1).

    [C Source File]
    -----------------------------------------------------------------------
    
        int func(int,int);
    
        main()
        {
               int i;
    
               i=func(func(3,2),1);
    
        }
    
    -----------------------------------------------------------------------
    
  3. Workaround
    Temporarily assign to TMP the return value from the function to be described as the first argument; then, pass the return value to the first argument.
    Example
    -----------------------------------------------------------------------
    
        i=func(3,2);
        i=func(i,1);
    
    -----------------------------------------------------------------------
    


NC30WA, NC30 Precautions
MESCT-NC30WA_2-981001D

Problem 2. On Bit Field Comparison
  1. Description
    Bit field comparison may result in incorrect code being generated.

  2. Conditions
    This problem occurs if the following two conditions are satisfied simultaneously:
    1. A logical operation between bit fields of one bit each is performed inside an expression to be evaluated in a conditional statement (i.e. if, while, for, switch, or ternary operator).
    2. A bit operator with higher priority exists at the right side of the expression, or a bitwise AND or bitwise OR operation in parentheses exists on the right of an operator.

    This problem also occurs if one of the following conditions is satisfied.

    1. The result of an operation that an expression including bit fields of one bit each is unary-negated is used as a logical value for another operation.
    2. The result of an operation that an expression including bit fields of one bit each is compared with 1 or 0 (==, ! =) is used as a logical value for another operation.
    3. The result of an operation that an expression including bit fields of one bit each is unary-negated and compared with 1 or 0 (==, ! =) is used as a logical value for another operation.

    Example 1
    -----------------------------------------------------------------------
    
        if(s.b0 | s.b1 & s.b2)
    
    -----------------------------------------------------------------------
    
    Example 2
    -----------------------------------------------------------------------
    
        if((!(s.b0 | (~s.b1 & s.b2))==1)&&(a==100))
    
    -----------------------------------------------------------------------
    
  3. Workaround
    1. When any product of V.1.00 Release 1 through V1.00 Release 3 used
      Give option "-Off=253" at compilation.
    2. When any product of V.2.00 Release 1 and later
      Give option "-Off=353" at compilation.

NC30WA, NC30 Precautions
MESCT-NC30WA_2-981001D

Problem 3. On "for" Statements
  1. Description
    Init expressions in "for" statements may result in incorrect initialization.

  2. Conditions
      This problem occurs if the following three conditions are satisfied:
    1. Any of options -O,-OR, and -OS is given at compilation.
    2. In a "for" or "while" statement, a loop condition is a comparison of a variable with a constant.
    3. Inside an init expression or before the "for" or "while" statement, a constant is assigned to a variable that is used in the loop condition.

    Example
    -----------------------------------------------------------------------
    
        i=10; 
    
        for(i=x;i<10;i++){
    
    -----------------------------------------------------------------------
    
  3. Workaround
    1. When any product of V.1.00 Release 1 through V1.00 Release 3 used
      Give option "-Off=297" at compilation.
    2. When any product of V.2.00 Release 1 and later
      Give option "-Off=397" at compilation.

NC30WA, NC30 Precautions
MESCT-NC30WA_2-981001D

Problem 4. On Addition of long Constants
  1. Description
    Addition of a long constant to a variable of type unsigned int may result in incorrect code being generated.

  2. Conditions
    This problem occurs if the following two conditions are satisfied:
    1. An immediate value with qualifier long is added to a variable of type unsigned int.
    2. The lower 2 bytes of the immediate value with qualifier long are 0.
    Example
    -----------------------------------------------------------------------
    
        unsigned int x;
        unsigned long a;
    
        a = 0x10000 + x;
    
    -----------------------------------------------------------------------
    
  3. Workaround
    Assign an int variable temporarily to a long variable; then, perform the operation.




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