Tool News
 
 
 

Tool News

Products Info
Downloads
Tools FAQs
RENESAS TOOL NEWS on March 1, 2005: RSO-M3T-NC30WA_4-050301D

A Note on Using
C-Compiler Package M3T-NC30WA

--On Calling String Handling Functions in the Standard Library--

Please take note of the following problem in using the M3T-NC30WA C-compiler package, which is used for the M16C/60, M16C/30, M16C/Tiny, M16C/20, M16C/10, and R8C/Tiny series of MCUs:
  • On calling string handling functions in the standard library


  1. Versions Concerned
    M3T-NC30WA V.5.00 Release 1 through V.5.30 Release 02


  2. Description
    If a source program that calls a library function declared in the standard header file <string.h> is compiled, an application error may arise, resulting in compilation being unsuccessfully terminated.

    2.1 Conditions
    This problem may occur if the following conditions are all satisfied.
    If no application error arises, however, code is properly generated:
    (1)Compile option -OR is selected.
    (2)Compile option -Ono_stdlib(-ONS) is not selected.
    (3)A function makes calls to a library function twice or more.
    (4)The library function called twice or more in (3) is any of the following:
    memcmp, memcpy, memicmp, memmove, strcat, strcmp, strcoll, strcpy, strcspn, stricmp, strncat, strncmp, strncpy, strnicmp, strpbrk, strspn, strstr, and strxfrm
    (All the above functions take two parameters of type pointer.)
    (5)At any of the calls to the library function in (3), far pointers (including address constants) are passed to both of the parameters.
    (6)The same function to which far pointers were passed in (5) is again called later, and a far pointer (including an address constant) is passed to either of the parameters, and a near pointer to the other.
    (7)At both calls in (5) and (6), the return value of the function in (3) is not referenced.
    (8)After both calls in (5) and (6), both the flows of processing merge. (If not so explicitly in the source program, optimization may bring such a result.)

    2.2 Example
    -----------------------------------------------------------------------
    #include <string.h>
    
    char near   nearstr[10];
    char far    far1str[10], far2str[10];
    int         cond;
    
    void func(void)
    {
       if (cond == 0x0001) {
           strcpy(nearstr, far2str);  /* Conditions (3), (4), (6), and (7) */
       } else {
           strcpy(far1str, far2str);  /* Conditions (3), (4), (5), and (7) */
       }
       cond = 0;                      /* Condition (8) */
    }
    -----------------------------------------------------------------------


  3. Workaround
    Select compile option -Ono_stdlib(-ONS) in addition to -OR.


  4. Schedule of Fixing the Problem
    We plan to fix this problem in the next release of the product.





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