Tool News
 
 
 

Tool News

Products Info
Downloads
Tools FAQs
MESC TOOL NEWS: MESCT-NC79WA-991016D

NC79WA, NC77WA
Precaution

Please take note of the following problems in using C compilers (with assembler and integrated development environment) NC79WA for the 7900 series and NC77WA for the 77xx series of microcomputers.


  1. Versions Concerned
    NC79WA V.1.00 Release 1 -- V.3.10 Release 2
    NC77WA V.3.00 Release 1 -- V.5.10 Release 1

  2. Problem
    When an integer constant cast to a pointer is involved in an arithmetic operation, an error will occur because the size of the type referenced by the pointer cannot be taken into consideration.

  3. Conditions
    This problem occurs if the following two conditions are satisfied:
    (1)A pointer to which an integer constant is cast is of type other than char, unsigned char, signed char, and void.
    (2)A subtraction is performed between pointers of the type described in (1) above (see Example 1), or an addition or subtraction is performed between a pointer of the type described in (1) above and an integer constant (see Example 2).

     ----------------------------------------------------------------------
    | [Example 1]
    | /* The expression below will give 0x0400 as n, not 0x0100, 
    |                                                the correct value. */
    | int n = ((long *)0x0800) - ((long *)0x0400);
    |
    | [Example 2]
    | /* The expression below will give 0x0402 as p, not 0x0408, 
    |                                                the correct value. */
    | long *p = ((long *)0x0400) + 2;
     ----------------------------------------------------------------------
    
  4. Workaround
    Declare temporary variables placed at the addresses specified by the integer constant by using the #pragma ADDRESS directive, not by casting integer constants to pointers; then perform arithmetic operations of these addresses of the variables directly.

    [Modifications of Examples 1 and 2]
     ----------------------------------------------------------------------
    | #pragma ADDRESS data_top 0400H
    | #pragma ADDRESS data_end 0800H
    | extern long data_top;
    | extern long data_end;
    |
    | int n = &data_end - &data_top;
    | long *p = &datatop + 2;
     ----------------------------------------------------------------------
    
    If code efficiency is an important issue in the subtraction between pointers of the type described in (1) above, perform the subtraction operation after casting integer constants to type unsigned int or unsigned long int, not to pointers, and then divide the result of the subtraction by sizeof (the type pointed to by pointers described in (1) above).
    [Example]
     ------------------------------------------------------------------------
    |  int n = ((unsigned int)0x0800 - (unsigned int)0x0400) / sizeof(long);
    |
     ------------------------------------------------------------------------
    
  5. Schedule of Fixing Problem
    We plan to fix this problem in our next release.





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