Tool News
 
 
 

Tool News

Products Info
Downloads
Tools FAQs
RENESAS TOOL NEWS on April 1, 2005: RSO-M3T-NC308WA-050401D

A Note on Using
the M3T-NC308WA C-Compiler Package

Please take note of the following problem in using the M3T-NC308WA C-compiler package with an assembler and an integrated development environment. This C-compiler package is used for the M32C/90, M32C/80, and M16C/80series of MCUs:
  • On using if-else constructs


  1. Versions Concerned
    M3T-NC308WA V.5.00 Release 1 through V.5.20 Release 02,
    which are used for the M32C/90, M32C/80, and M16C/80 series of MCUs.


  2. Description
    Regardless of whether the result of evaluation of the controlling expression in an if statement is TRUE or FALSE, incorrect code will be generated if statements for assigning a constant to a member of a bit field exist in the TRUE and FALSE statements.

    2.1 Conditions
    This problem occurs if the following conditions are all satisfied:
    (1) An if-else construct exists.
    (2) Regardless of whether the result of evaluation of the controlling expression in an if statement in (1) is TRUE or FALSE, constants are assigned to members of bit fields of a structure, where the bit fields have the same name as variables.
    (3) The bit fields to which constants are assigned in (2) are1 bit wide (those not assigned can be wider than 1).
    (4) The bit fields in (2) are different in bit positions depending on whether each of them is put in the TRUE or FALSE statement.
    (5) The constants in (2) are also different depending on whether each of them is assigned in the TRUE or FALSE statement.

    2.2 Example
    -------------------------------------------------------------
    char        c;
    
    struct S
    {
        int         b0:1;            /* Conditions (3) and (4) */
        int         b1:1;            /* Conditions (3) and (4) */
        int         b2:1;
        int         b3:1;
        int         b4:1;
        int         b5:1;
        int         b6:1;
        int         b7:1;
        int         b8:8;
    }s;
    
    void        func( void )
    {
        if ( c == 1 ){                /* Condition (1) */
            s.b0 = 0;  /* Conditions (2), (3), (4), and (5) */
        }
        else{                        /* Condition (1) */
            s.b1 = 1;  /* Conditions (2), (3), (4), and (5) */
        }
    }
    -------------------------------------------------------------

  3. Workaround
    Place a dummy asm() function anywhere in the else block.
    -------------------------------------------------------------
    char        c;
    
    struct S
    {
          int         b0:1;
          int         b1:1;
          int         b2:1;
          int         b3:1;
          int         b4:1;
          int         b5:1;
          int         b6:1;
          int         b7:1;
          int         b8:8;
    }s;
    
    
    void        func( void )
    {
          if ( c == 1 ){
              s.b0 = 0;
          }
          else{
              s.b1 = 1;
              asm();          /* Dummy asm() function placed */
          }
    }
    -------------------------------------------------------------

  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