Tool News
 
 
 

Tool News

Products Info
Downloads
Tools FAQs
RENESAS TOOL NEWS on August 1, 2006 060801/tn2

A Note on Using the C Compiler Packages
--M3T-NC308WA and M3T-NC30WA--
for the M16C MCU Family
--On Address Calculations
Made in an Iteration Statement--


Please take note of the following problem in using the C compiler packages
--M3T-NC308WA and M3T-NC30WA--for the M16C MCU family:
     - On address calculations made in an iteration statement


  1. Products and Versions Concerned
    • The M3T-NC308WA V.1.00 Release 1 through V.5.40 Release 00
      (the C compiler package for the M32C/90, M32C/80, and M16C/80 series)
    • The M3T-NC30WA V.1.00 Release 1 through V.5.40 Release 00A
      (the C compiler package for the M16C/60, M16C/30, M16C/20, M16C/10, M16C/Tiny, and R8C/Tiny series

  2. Description
    When address calculations are made in an iteration statement, incorrect results will be yielded if the increment of the loop counter is greater than one.


  3. Conditions
    This problem occurs if the following conditions are all satisfied:

    (1)   In the program exists such an iteration statement as "for" or "while".
    (2)   The loop counter is of type signed int, unsigned int, signed short or unsigned short.
    (3)   The increment of the loop counter is greater than one.
    (4)   In an iteration statement exists such an address calculation that references an array)
    Here, the array is any one of these types, signed int, unsigned int, signed short and unsigned short.
    (5)   The controlling expression in an iteration statement performs a comparison with a constant expression.
    (6)   The variables used in the loop counter and for address calculations are those whose domains have been reserved in the stack frame.
    (7)   The optimizing option -OS or -OS_MAX(-OSM) is used.
    Example:
    ------------------------------------------------
    unsigned char buf[];       /* Condition (4) */
    unsigned char *p;
    for ( i=0; i<2; i+=2 ) {   /* Conditions (1), (2), (3), and (5) */
        p = buf + i*2;         /* Condition (4) */
       *p=0x00;
     }
    ------------------------------------------------
  4. Workaround
    Place a dummy asm function within the iteration statement.
    Example:
    ------------------------------------------------
     unsigned char buf[]; 
     unsigned char *p;
     for ( i=0; i<2; i+=2 ) { 
         asm()I;               /* Dummy asm function placed */
             p = buf + i*2;
            *p=0x00;
        }
    ------------------------------------------------

  5. Schedule of Fixing the Problem
    We plan to fix this problem in the next release of the products.

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