Tool News
 
 
 

Tool News

Products Info
Downloads
Tools FAQs
MAEC TOOL NEWS: MAECT-M3T-NC308WA-011001D

M3T-NC308WA, M3T-NC30WA,
M3T-NC79WA, and M3T-NC77WA
Precautions

Please take note of the following problems in using C compilers M3T-NC308WA, M3T-NC30WA, M3T-NC79WA, and M3T-NC77WA:
  • On setting initial values for arrays of integer types
  • On making a comparison (including an equality/inequality test) between floating-point numbers using an if statement


  1. Problem on Setting Initial Values for Arrays of Integer Types
    1.1 Products and Versions Concerned
    Compiler for the M16C/80 series MCUs
    : M3T-NC308WA V.2.00 Release 1 -- V.3.10 Release 3
    Compiler for the M16C/60, and M16C/20 series MCUs
    : M3T-NC30WA V.3.20 Release 1 -- V.4.00 Release 2
    Compiler for the 7900 series MCUs
    : M3T-NC79WA V.3.20 Release 1 -- V.4.10 Release 1
    Compiler for the 77xx series MCUs
    : M3T-NC77WA V.5.20 Release 1 -- V.5.20 Release 4

    1.2 Description
    Initial values for arrays of integer types may be compiled incorrectly.

    1.3 Conditions
    This problem occurs if the following four conditions are satisfied
    (though it might not arise depending on constructions of C-language source programs even if all the conditions are met):
    (1) Initial values for an array of integer types are set at the same time the array is defined as global variables or static variables.
    (2) The initial value of the first element of the array in (1) is not an expression including an operator. (See Note.)
    (3) Any of the initial values of the second and later elements is an expression including an operator. (See Note.)
    (4) The value immediately after the expression including an operator in (3) is an integer constant greater than or equal to 256 and less than or equal to 342 in decimal notation.
    Note: A minus sign, a cast operator, and others are included.

    1.4 Examples
    -------------------------------------------------------------
    Example 1:
      int array1[] = {1,-5,302};                        /* NG */
      int array2[] = {-1,-5,302};                       /* OK */
    
    Example 2:
      int i;
      unsigned long addr1[] = {0,(unsigned long)&i,308};/* NG */
      unsigned long addr2[] = {(unsigned long)0,
                                (unsigned long)&i,308}; /* OK */
    -------------------------------------------------------------
    1.5 Workaround
    If this problem occurs, place a cast operator in front of the initial value of the first element of the array
    -------------------------------------------------------------
    Example 1:
      int array1[] = {(int)1,-5,302};    /* Cast operator "int" added */
    
    Example 2:
      int i;
      unsigned long addr1[] = {(unsigned long)0,
                                (unsigned long)&i,308}; 
                               /* Cast operator "unsigned long" added */
    -------------------------------------------------------------
    1.6 Schedule of Fixing the Problem
    We plan to fix this problem in our next release.



    M3T-NC308WA, M3T-NC30WA, M3T-NC79WA, and M3T-NC77WA Precautions
    MAECT-M3T-NC308WA-011001D

  2. Problem on Making a Comparison (including an equality/inequality test) between Floating-Point Numbers Using an if Statement
    2.1 Products and Versions Concerned
    Compiler for the M16C/80 series MCUs
    : M3T-NC308WA V.1.00 Release 1 -- V.3.10 Release 3
    Compiler for the M16C/60, and M16C/20 series MCUs
    : M3T-NC30WA V.2.00 Release 1 -- V.4.00 Release 2

    2.2 Description
    Making a comparison between floating-point numbers using an if statement may results in incorrect code being generated.

    2.3 Conditions
    This problem occurs if the following four conditions are satisfied:
    (1) The -OR option is used.
    (2) An if-else statement is used.
    (3) In the conditional expression of the if statement is made a comparison (>, >=, <, <=, ==, !=) between floating-point numbers.
    (4) In both the program statements of the if and else statements, the same variable assigned to a register is read out.

    2.4 Example
    -------------------------------------------------------------
    int     gi;
    void func(void)
    {
            float   ff;
            int     ii=gi;
    
            if(ff < 1.2F){     /* Conditions (2) and (3) */
                    ii++;      /* Condition (4) */
            }else{
                    ii--;      /* Condition (4) */
            }
    }
    -------------------------------------------------------------
    2.5 Workaround
    Describe a dummy "asm" function at the line immediately before the condition (4) in the program statement of either the if or else statement.
    [Example]
    -------------------------------------------------------------
    int     gi;
    void func(void)
    {
            float   ff;
            int     ii=gi;
    
            if(ff < 1.2F){
                    asm();     /* A dummy "asm" function added */
                    ii++;
            }else{
                    ii--;
            }
    }
    -------------------------------------------------------------
    2.6 Schedule of Fixing the Problem
    We plan to fix this problem in our next release.




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