I've been using the HiTech PICC-18 compiler for a recent project, and have been experiencing some extremely odd behavior. I'm reluctant to point the finger at the compiler, but I can't figure out what else is going wrong. I have a function that seemed to be trashing a global variable. The variable value is reported back via an I2C link. I stripped the function down to the absolute bare bones and there was no change. In desperation, I "commented" out the original function using #ifdef QWERTY and #endif, where QWERTY is obviously an undefined symbol. Underneath the original function, I made a copy that I could tweak. However, when I re-compiled, the problem had gone. To check, I deleted the copy, and uncommented the original and the problem returned. This is totally repeatable. To summarise: The following gives problems with global variable corruption void myfunc(void) { // my code here } The following works correctly. #ifdef QWERTY void myfunc(void) { // my code here } #endif void myfunc(void) { // my code here } My question is, how likely is this a compiler bug, and whats the best way of proving it one way or the other? Finding this problem has taken the best part of a week, and I'm worried that other parts of the code are going to be similarly affected. The code is more or less a direct port from a product that used the 16F877 compiled with HiTech PICC, and this problem was never seen. Regards Mike -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu