C51 Version 9.59 Release

  • [New Supported Devices]
  • [AX51 Macro Assembler]
    • Corrected: allow slash ‘/’ in addition to backslash ‘\’ as a directory separator in all places
  • [CX51 Compiler]
    • Corrected: sometimes the compiler shows warning C290: missing return value or warning C291: not every path returns a value although a value is returned.
    • Corrected: in some cases post increment was not applied. Example:
      unsigned char reader;
      unsigned char count;
      unsigned int  index;
      
      index = 0;
      
      write_byte(offset);
      
      for (count = 0; count < 10; count++) {
        reader = read_byte();
        pData[index++] = reader;
      }
      ...
      

      Wrong code was generated:

      ...
      000D 120000      R     LCALL   read_byte
      ;---- Variable 'reader' assigned to Register 'R5' ----
      0010 AD07              MOV     R5,AR7
      0012 EB                MOV     A,R3
      0013 2500        R     ADD     A,index+01H
      0015 F582              MOV     DPL,A
      0017 EA                MOV     A,R2
      0018 3500        R     ADDC    A,index
      001A F583              MOV     DPH,A
      001C ED                MOV     A,R5
      001D F0                MOVX    @DPTR,A
      001E 0C                INC     R4
      ...
      

      now the correct code is generated:

      ...
      ;---- Variable 'reader' assigned to Register 'R5' ----
      001A AD07              MOV     R5,AR7
      001C 8B82              MOV     DPL,R3
      001E 8A83              MOV     DPH,R2
      0020 0500        R     INC     index+01H
      0022 E500        R     MOV     A,index+01H
      0024 AE00        R     MOV     R6,index
      0026 7002              JNZ     ?C0007
      0028 0500        R     INC     index
      002A         ?C0007:
      002A 14                DEC     A
      002B 2582              ADD     A,DPL
      002D F582              MOV     DPL,A
      002F E583              MOV     A,DPH
      0031 3E                ADDC    A,R6
      0032 F583              MOV     DPH,A
      0034 ED                MOV     A,R5
      0035 F0                MOVX    @DPTR,A
      0036 0C                INC     R4
      ...
      
    • Corrected: allow slash ‘/’ in addition to backslash ‘\’ as a directory separator in all places
    • Corrected: in rare cases a signed compare with unsigned char treated the unsigned char as signed. This happens if the unsigned char value results from a calculated assignment. Example:
      char i;
      unsigned char uc0 = 254;
      char c1 = 0;
      
      void main() {
        if (c1 <= (uc0 += c1)) // uc0 is wrongly treated signed => -2 therefore the condition (0 <= -2) is false
          i = 1;
        else
          i = 0;
      }
      

      Wrong code was generated:

      0000 E500        R     MOV     A,uc0
      0002 2500        R     ADD     A,c1
      0004 F500        R     MOV     uc0,A
      0006 D3                SETB    C
      0007 6480              XRL     A,#080H       \
      0009 F8                MOV     R0,A          |
      000A E500        R     MOV     A,c1          |
      000C 6480              XRL     A,#080H       |
      000E 98                SUBB    A,R0          |
      000F 5004              JNC     ?C0001        -> signed char compare
      0011 750001      R     MOV     i,#01H
      0014 22                RET
      0015         ?C0001:
      0015 E4                CLR     A
      0016 F500        R     MOV     i,A
      0018         ?C0003:
      0018 22                RET
      

      The correct code is much longer because according to the C standard a cast to int is necessary:

      0000 E500        R     MOV     A,uc0
      0002 2500        R     ADD     A,c1
      0004 FF                MOV     R7,A
      0005 F500        R     MOV     uc0,A
      0007 AD00        R     MOV     R5,c1         \
      0009 ED                MOV     A,R5          |
      000A 33                RLC     A             |
      000B 95E0              SUBB    A,ACC         |
      000D FC                MOV     R4,A          -> cast of signed char to int
      000E D3                SETB    C             \
      000F ED                MOV     A,R5          |
      0010 9F                SUBB    A,R7          |
      0011 7480              MOV     A,#080H       +> implicit cast of unsigned char to int
      0013 F8                MOV     R0,A          |
      0014 6C                XRL     A,R4          |
      0015 98                SUBB    A,R0          |
      0016 5004              JNC     ?C0001        -> signed int compare
      0018 750001      R     MOV     i,#01H
      001B 22                RET
      001C         ?C0001:
      001C E4                CLR     A
      001D F500        R     MOV     i,A
      001F         ?C0003:
      001F 22                RET
      

      To generate smaller code the signedness of the values to be compared should be the same:

      ...
          if ((unsigned char)c1 <= (uc0 += c1)) ... 0000 E500 R MOV A,uc0 0002 2500 R ADD A,c1 0004 FF MOV R7,A 0005 F500 R MOV uc0,A 0007 E500 R MOV A,c1 0009 D3 SETB C \ 000A 9F SUBB A,R7 | 000B 5004 JNC ?C0001 -> unsigned char compare
      000D 750001      R     MOV     i,#01H
      0010 22                RET
      0011         ?C0001:
      0011 E4                CLR     A
      0012 F500        R     MOV     i,A
      0014         ?C0003:
      0014 22                RET
      
  • [LX51 Linker/Locater]
    • Corrected: in rare cases the linker crashes if using long function names and Global Register Coloring
    • Corrected: somehow not only function names were listed in the call tree and warning L48: IGNORED RECURSION, CALL REMOVED appeared
    • Corrected: sometimes automatic rebuilds are not executed when Global Register Coloring is used
    • Corrected: in case of banked applications and under some circumstances the CONST– as well as the CODE-Segments located to the same bank address.
    • Corrected: under some circumstances the MERGEPUBLICS does not work for sbit variables.
  • [Debug Commands]
  • [µVision]
    • This C51 release comes with µVision V5.25.2.
  • [Supported Operating Systems]
2018-05-22T18:04:43+00:00