Tool News
 
 
 

Tool News

Products Info
Downloads
Tools FAQs
MESC TOOL NEWS: MESCT-NC30WA-980716D

NC30WA and NC30
Precautions

Please take note of the following problems in using C compilers NC30WA and NC30 for the M16C/60 series of microcomputers.



Problem 1. On "xor" operations between two single bits
  1. Description
    When "xor" operations are performed between two single bits, incorrect codes may be output.

  2. Versions Concerned
    V.1.00 Release 1--V.3.00 Release 1 are concerned with this problem.

  3. Conditions
    The problem may occur if all the following three conditions are satisfied:

    1. An "xor" ("AND" and "OR") operation between two single bits is performed.
    2. Both the bit with which the "xor" operation is performed and the destination bit into which the result is stored point to the same address.
    3. The positions of the bits mentioned above are different from each other.

    ------------------------------------------------------------------
    [Example]
    
    struct tag{
                     unsigned char  b0:1;
                     unsigned char  b1:1;
                     unsigned char  b2:1;
                     unsigned char  b3:2;
                     unsigned char  b4:1;
                     unsigned char  b5:1;
                     unsigned char  b6:1;
                     unsigned char  b7:1;
    }bit;
    
    struct tt{
                     unsigned char  b0:1;
                     unsigned char  b1:1;
                     unsigned char  b2:1;
                     unsigned char  b3:2;
                     unsigned char  b4:1;
                     unsigned char  b5:1;
                     unsigned char  b6:1;
                     unsigned char  b7:1;
    }bb;
    
    bb.b0=bb.b1^bit.b0;
    ------------------------------------------------------------------
    
  4. Workaround
    Assign the result of the operation to a TMP variable temporarily and then transfer it to the destination bit.


NC30WA and NC30 Precautions
MESCT-NC30WA-980716D

Problem 2. On "and" operations performed to constants
  1. Description
    When "and" operations are performed to the data of constants which are cast to pointers of type volatile, system errors may occur.

  2. Versions Concerned
    V.1.00 Release 1--V.3.00 Release 1 are concerned with this problem.

  3. Conditions
    1. Optimize option -O, -OR, or -OS is given.
    2. An "and" operation is performed to the data of a constant which is cast to a pointer of type volatile.

    The problem may occur if both of the above conditions are satisfied and a branch with a specific pattern is performed. A branch with a specific pattern is the one that a return or branch exists after the destination of a branch in the generated assembler.
    ------------------------------------------------------------------
    [Example]
    
    unsigned char c;
    func(void)
    {
          switch(c){
          case 1:
                func();
                break;
          case 2:
                break;
          default:
                *(volatile int*)(0x0300) &= 0x04 ;
                return;
          }
          func1();
          return;
    }
    ------------------------------------------------------------------
    
  4. Workaround
    Add an asm function just before the description of an "and" operation.


NC30WA and NC30 Precautions
MESCT-NC30WA-980716D

Problem 3. On optimization of expelling invariants in a loop
  1. Description
    When optimization is performed to expel invariants in a loop, incorrect codes may be output.

  2. Versions Concerned
    V.1.00 Release 2--V.3.00 Release 1 are concerned with this problem.

  3. Conditions
    The problem may occur if all the following four conditions are satisfied:
    1. Optimize option -OS is given.
    2. Pointers or reads/writes of unions exist in a loop.
    3. The descriptions of read access and write access are different from each other.
    4. The memory (pointer) of a read and that of a write point to the same address.
    ------------------------------------------------------------------
    [Example]
    
    for(i = 0x00 ; i < 0x10 ; i++){
         if(str->uni.bit.bit16)
               a= 1;
         str->uni.word[1] = str->uni.word[1] >> 1;
    }
    ------------------------------------------------------------------
    
    In the above example, "str->uni.bit.bit16" points to the same address as "str->uni.word[1]".

  4. Workaround
    Don't use optimize option -OS, or add a dummy inline-function just before a bit access statement.
    ------------------------------------------------------------------
    [Example]
    
    inline void dummy_inline(void){};
    for(i = 0x00 ; i < 0x10 ; i++){
               dummy_inline();
       if(str->uni.bit.bit16)
             (The rest is omitted.)
    ------------------------------------------------------------------
    



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