Tool News
 
 
 

Tool News

Products Info
Downloads
Tools FAQs
MAEC TOOL NEWS: MAECT-NC77-020601D

A note on C Compiler NC77

Please take note of the following problem in using C compiler NC77 released before C compiler (with an assembler and integrated development environment) M3T-NC77WA for the 77xx series MCUs.
  • Comparing the evaluation results of the right and left terms of a conditional operator, both of type singed long or unsigned long, may result in incorrect code being generated.


  1. Versions Concerned
    NC77 V.3.00 Release 1 -- V.3.10 Release 2

  2. Description
    Comparing the evaluation results of the right and left terms of a conditional operator, both of type singed long or unsigned long, may result in the following incorrect code being generated:
    The comparison of the upper 2 bytes of a variable with those of another is replaced by the comparison of the lower 2 bytes of them.

    2.1 Conditions
    This problem occurs if the C-language program satisfies all the conditions described in either Condition A or B below.
    Condition A
    (1) The evaluation results of the right and left terms of a conditional operator, both of type singed long or unsigned long, are compared. (The results of implicit conversions make valid comparisons, of course.)
    (2) A less than (<) or a greater than or equal to (=>) operator is used.
    (3) The term to the left of the above operator is an auto variable.
    (4) The term to the right of the above operator is such a value saved in a register as a function return value, an operation result, or a value pointed to by a pointer variable.

    Condition B
    (1) The evaluation results of the right and left terms of a conditional operator, both of type singed long or unsigned long, are compared. (The results of implicit conversions make valid comparisons, of course.)
    (2) A greater than (>) or a less than or equal to (<=) operator is used.
    (3) The term to the right of the above operator is an auto variable.
    (4) The term to the left of the above operator is such a value saved in a register as a function return value, an operation result, or a value pointed to by a pointer variable.

    2.2 Example
    [In Condition A]
    -------------------------------------------------------------
       int i, j;
       long l;
    
       if( l < (m + m) )
            :
    -------------------------------------------------------------
  3. Workaround
    If this symptom arises, temporarily save the value described in (4) of Condition A or B in an auto variable; then compare auto variables with each other.
    [Example in Condition A]
    -------------------------------------------------------------
         int i, j;
         long l;
         long tmp;
    
         tmp = m + n;     /* Operation result saved in an auto variable */
         if( l < tmp )    /* Comparison made between auto variables */
              :
    -------------------------------------------------------------
  4. Solution
    Please use NC77 V.3.20 Release 1 or later.




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