Menu

#819 Errors in PIC16's genMinus

closed-fixed
5
2013-05-25
2004-09-26
No

The following program produces incorrect results where
indicated:

#include <pic18fregs.h>
#pragma stack 0x300 0x100

int main ()
{
volatile long res, val1, val2;
volatile long lres, lval1;

PORTE=0;
res = 0x1234;
res = 12 - res; // patch at 1500 (this failed)

val2 = 0x4567;
res = 0x2345;
res = res - val2; // patch at 1569

val1 = 0x2345;
res = 0x2344;
res = val1 - res; // patch at 1573 (this failed)

lval1 = 0x12345678L;
lres = 0x23456789L;
lres = lres - lval1; // patch at 1569 (this failed)

return 0;
}

I uploaded a patch for these issues.
The patch also simplifies the genMinus' code by
introducing efficient code for a more general case than
before (especially patching at 1488,1549 does so).

I left in "comments" for your convenience, feel free to
remove them.

Raphael Neider

Discussion

  • Raphael Neider

    Raphael Neider - 2004-09-26

    Patch for genMinus

     
  • Vangelis Rokas

    Vangelis Rokas - 2004-10-01
    • milestone: --> fixed
    • assigned_to: nobody --> vrokas
    • status: open --> closed-fixed
     
  • Vangelis Rokas

    Vangelis Rokas - 2004-10-01

    Logged In: YES
    user_id=770505

    Patch applied succesfully.
    Bug fixed in SDCC v.2.4.5 #851

     

Log in to post a comment.