#807 assignment from SFRs buggy?

closed-fixed
5
2013-05-25
2004-09-03
Raphael Neider
No

The following code fragment of PIC16 code shows unusual
behaviour:
(1) byte value, byte temp compiles ok
(2) byte value, long temp compiles ok
(3) long value, long temp compiles ok
(4) long value, byte temp failes with assertion in
gen.c, line 10903.

sdcc: gen.c:10903: genAssign: Assertion `0' failed.
Caught signal 6: SIGABRT

After removing the function hurdle() (or by moving it
below assign_demo()) the code compiles nicely in all of
the above cases...

Here is the code:
---
#include "pic18f6720.h"

typedef unsigned char byte;

void hurdle () {
// do nothing
}

int assign_demo ()
{
long value;
byte temp;

value = ADRESH;
temp = ADRESL;
value |= temp;
return value;
}
---
A workaround is possible by casting ADRESL to
(long)ADRESL, but still there seems to be a problem...

Tested with SDCC : pic16 2.4.3 #826 (Aug 30 2004) (UNIX),
command line: sdcc -mpic16 -p18f6720 -I
~/sdcc/device/include/pic16 -I ~/sdcc/device/include
assign_gen.c

Discussion

  • Vangelis Rokas
    Vangelis Rokas
    2004-09-13

    • milestone: --> fixed
    • assigned_to: nobody --> vrokas
    • status: open --> closed-fixed
     
  • Vangelis Rokas
    Vangelis Rokas
    2004-09-13

    Logged In: YES
    user_id=770505

    Bug fixed in SDCC version 2.4.4 #837