Compiling the attached source file with the following command:
$ sdcc -mpic16 -p18f65j50 --use-non-free -c xbee_txpacket.c
silently generates bad code. Specifically, the following snippet appears in the assembly output:
; .line 14; xbee_txpacket.c if (!ready_queue.head->field) {
MOVFF _ready_queue, r0x00
MOVF r0x00, W
BNZ _00106_DS_
; .line 15; xbee_txpacket.c LATBbits.LATB0 = 1;
It's quite obvious that the three listed assembly instructions do not do what the source line above them says. The source line should go to the (known-at-compile-time) address of the "head" field of the "ready_queue" structure, *dereference the pointer found there*, and then check whether the byte in "field" at the thus-found structure is zero or not. The assembly instructions, on the other hand, merely check whether the first byte of the "head" pointer itself is zero!
$ sdcc --version
SDCC : pic16/pic14 3.0.0 #6037 (Nov 8 2010) (Linux)
The source file
Interestingly, further investigation suggests this only affects the *FIRST* element of the pointed-to structure; accesses to subsequent elements work fine.