Menu

#1423 Invalid subtraction code

closed-fixed
nobody
5
2013-05-25
2008-01-22
Don Wooton
No

I have found a condition where sdcc is generating invalid code for 32 bit subtraction.

I am compiling for -mpic14 -p16f877a

I tested with sdcc source taken from svn on 16-Sep-07 and again with source taken from svn on 21-Jan-08 and get the same results.

$ sdcc -v
SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.7.4 #4996 (Jan 21 2008) (UNIX)

The simulator and the real PIC seem to get the same results.

For the errCase() routine the result of
(5000 - 1) is 4743
(0x00001388 - 0x00000001) is 0x00001287

For the okCase() routine the result of
(5000 - 1) is 4999
(0x00001388 - 0x00000001) is 0x00001387

Is this a known problem?

I have changed my code to use the volatile workaround shown in okCase().

- Don

Discussion

  • Don Wooton

    Don Wooton - 2008-01-22

    Source, Makefile and asm

     
  • Raphael Neider

    Raphael Neider - 2008-03-04
    • milestone: --> fixed
    • status: open --> closed-fixed
     
  • Raphael Neider

    Raphael Neider - 2008-03-04

    Logged In: YES
    user_id=1115835
    Originator: NO

    Hi Don,

    the problem was not known (to me), but by now it is history: I have just committed a fix for this as SDCC r5066.
    I feel that besides the fixed subtraction, also the addition code generator needs some maintenance, so there will probably soon (just before the upcoming code freeze or after the release) be another update.

    Thank you for reporting the problem!

    Regards,
    Raphael

     

Log in to post a comment.

MongoDB Logo MongoDB