struct NODE{ struct NODE Succ; struct NODE Prev; }; struct LIST{ struct NODE *Head; struct NODE *Tail; int count; }; struct LIST *List; struct NODE *N; ...... for(N = List->Head;N;N = N->Succ) { ...... }
"List is placed in XDATA because I use the large memory model" Ok, but shouldn't N therefore be placed in xdata as well? Quoting from your map file above: 02000000H SYMBOL XDATA --- List 00000001H SYMBOL DATA --- N "N is used in code: "N = List->Head" and "N = N->Succ" in the for-loop" Yes, I must have been sleeping. Again. I think Hans is right, the optimisation is legitimately causing this. The order of events is (pseudocode): List=An address; N=List->Head; LABEL: N=N->Succ; if(N) goto LABEL So, List and N can occupy the same location without anything going wrong. Stefan