#2128 [PIC14] Bad code generated for assignment to/from __data ptr

open
nobody
PIC14
5
2013-05-25
2013-01-13
Raphael Neider
No

source.c:
struct s {
struct s *ptr;
__data struct s *near;
};

void main()
{
struct s d, e;

e.ptr = &d;
e.near = &d;
}

command:
sdcc -mpic14 -p16f877a source.c

version:
SDCC r8385.

output:
The generated .asm code is wrong; no errors or warnings are displayed.

The assignment to e.ptr takes the address of d (MOVLW) and correctly assigns it.
The assignment to e.near takes the value of d (MOVF) and incorrectly assigns it.

Discussion

    • Category: --> PIC14
    • Group: --> fixed