SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08
2.6.1 #4478 (Nov 23 2006) (MINGW32)
When compiling the following snippet for mcs51, both *px translates to

 mov dptr,#_x
 movx a,@dptr

i.e. *x, which may not be true.

Is this an error or just me being stupid?

Jan Waclawek

PS. In this short test program,  I am unable to insert some code modifying
px before "if", to demonstrate that the "if" is not redundant, without
"spoiling the error", but I have a long-long program where this really
happens.

--- code snippet ---
xdata unsigned char *px;
xdata unsigned char x[3];

unsigned char t;


void incrementpx(void) {
  px++;
}

void main(void) {
  px = x;

  if (px == x) {
    incrementpx();
    t = *px;
  } else {
    t = *px;
  }
}




-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to