Tool News
 
 
 

Tool News

Products Info
Downloads
Tools FAQs
RENESAS TOOL NEWS on December 1, 2004: RSO-M3T-NC308WA-041201D

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

Please take note of the following problem in using the M3T-NC308WA and M3T-NC30WA C-compiler packages:
  • On using inline functions


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

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


  2. Description
    Incorrect code may be generated for the portion where a register variable is referenced within an inline function.


  3. Conditions
    This problem occurs if the conditions stated in Pattern 1 or Pattern 2 below are all satisfied.

    Pattern 1:
    (1)A register variable is defined within an inline function.
    (2)An if construct exists in the inline function in (1).
    (3)Two or more assignment expressions to the register variable in (1) exist in the inline function. Assume that one of these expressions is A and one of the expressions placed after A is B.
    (4)Expression A is placed before the if construct.
    (5) Expression B is placed only in the true or false statements of the if construct.
    (6)Any one or more of the compile options -O, -OS, and -OR are used.
    (7)Also compile option -fER is used.
    Example 1
    -------------------------------------------------------------------
    extern char     a, b, c;
    
    inline void func(void)
    {
         register int    r = a;  /* Conditions (1), (3) and (4) */
    
         if (r < b) {            /* Condition (2) */
                 r = b;          /* Conditions (3) and (5) */
         }
    }
    
    void testmain(void)
    {
          func();
    }
    -------------------------------------------------------------------

    Pattern 2:
    (1)A register variable is defined within an inline function.
    (2)Two or more assignment expressions to the register variable exist in the inline function. Here, assume that one of these expressions is A and one of the expressions placed after A is B.
    (3)Between A and B is placed an assignment expression, C, to any other than the register variable, whose right term is the same as B's.
    (4)Between C and B is referenced the register variable in (1).
    (5)Any one or more of the compile options -O, -O1, -O2, -O3, -O4, -O5, -OR, and -OS are used.
    (6)Also compile option -fER is used.
    Example 2
    -------------------------------------------------------------------
    extern char     aa, bb, xx, yy, zz;
    
    inline void func(void)  /* Condition (1) */
    {
       register char   r;  /* Condition (1) */
       char    s;
    
       r = aa + 2;     /* Condition (2) */
       xx = bb + 1;    /* Condition (3) */
       s = r;          /* Condition (4) */
    
       r = bb + 1;     /* Condition (2) */
       yy = r;
       zz = s;
    }
    
    void testmain(void)
    {
         func();
    }
    -------------------------------------------------------------------

  4. Workaround
    This problem can be circumvented any of the following ways:
    (1) Don't declare a register variable.
    (2) Don't use compile option -fER.
    (3) Place a dummy asm function before referencing a register variable.
    Modification of Example 1:
     -------------------------------------------------------------------
         . . . . . . . . . . . . . 
    
          if (r < b) {
                  asm();          /* Place a dummy asm function */
                  r = b;
          }
    
         . . . . . . . . . . . . . . 
    
     -------------------------------------------------------------------
    
    Modification of Example 2:
     -------------------------------------------------------------------
     . . . . . . . . . . . . . . . . . 
    
     inline void func(void)
     {
         register char   r;
         char    s;
    
         r = aa + 2;
         xx = bb + 1;
         s = r;
         asm();          /* Place a dummy asm function */
         r = bb + 1;
         yy = r;
         zz = s;
     }
     . . . . . . . . . . . . . . . . . .
    
     -------------------------------------------------------------------


  5. Solution
    This problem has already been fixed in the latest versions of the products, the M3T-NC308WA V.5.20 Release 1 and the M3T-NC30WA V.5.30 Release 1.
    So Please update yours to those online from Software download for tools.





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