#1337 PIC16: Initialized pointers to structs are not supported

open
PIC16
5
2013-07-16
2007-05-22
Raphael Neider
No

The following code fragment does not compile for the pic16 port, although it is perfectly legal and potentially useful:

<code name="init-ptr-struct.c">
struct foo {
int a;
};
struct foo f={1};
struct foo *g=&f; // This line fails!
</code>

sdcc 2.7.0, r4810 fails with

$ sdcc -mpic16 -p18f1220 init-ptr-struct.c
at 5: error 129: pointer types incompatible

Discussion

  • Maarten Brock
    Maarten Brock
    2009-11-01

    Problem is probably in glue.c. Please compare with SDCCglue.c.

     
  • I just verified that this problem still exists in 2.9.7 #5983.

    Philipp

     
  • Maarten Brock
    Maarten Brock
    2011-09-18

    • summary: Initialized pointers to structs are not supported --> PIC16: Initialized pointers to structs are not supported
     
    • Category: --> PIC16