I have a flag bit variable that is set by an interrupt routine. Then in my main loop the flag is checked like:
adc0_flag = 0; while(1){ if(adc0_flag == 1){ adc0_flag = 0; process_data() } ... }
"call to process_data() was optimized out " Are you sure it's optimisation? Are you sure there isn't some other problem? Have you checked the generated assembler? The code you posted has at least one typo - please cut-and-paste the exact code you are compiling! In the expression
(adc0_flag == 1)
if( adc0_flag ){