Hello!

I ported some working code to SDCC (PIC14, SVN ver. 8444). 
And probably find bug in sdcc.
Striped down and preprocessed code looks OK

***************************test.c**********************************************
extern __at(0x0007) __sfr PORTC;
  
typedef struct
  {
  unsigned RC0 : 1;
  unsigned RC1 : 1;
  unsigned RC2 : 1;
  unsigned RC3 : 1;
  unsigned RC4 : 1;
  unsigned RC5 : 1;
  unsigned RC6 : 1;
  unsigned RC7 : 1;
  } __PORTCbits_t;

extern __at(0x0007) volatile __PORTCbits_t PORTCbits;
void
main(void)
{
 ((PORTCbits.RC3 = 1),(PORTCbits.RC3=0));
}
********************************************************************************

But compile:

sdcc --use-non-free --opt-code-size -mpic14   -p16f785 lcdp.c -o lcdp
popGet: (offset[0] > AOP_SIZE(op)[0]-1) && AOP_TYPE(op) != AOP_LIT)
WARNING: encountered NULL pcop--this is probably a compiler bug...

generated code:
***********************************************************************************
_main   ;Function start
; 2 exit points
;       .line   20; "lcdp.c"    ((PORTCbits.RC3 = 1),(PORTCbits.RC3=0));
        BANKSEL _PORTCbits
        BSF     _PORTCbits,3
        BCF     _PORTCbits,3
        MOVLW   (_PORTCbits + 0)
        MOVWF   FSR
        BCF     STATUS,7
        BTFSC   (_PORTCbits+1),0
        BSF     STATUS,7
        MOVF    INDF,W
        ANDLW   0x08
        BTFSS   STATUS,2
        RETURN
; exit point of _main

First lines looks OK, but testing unimplemented address 0x8 and conditional 
return is wrong.

Albert 


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to