下面这段代码不优化才正常,优化就跑飞!!!谁能分析下为什么?
===============================================
#include <avr/io.h>
unsigned char ret;
unsigned char Test(unsigned char tmp)
{
if(tmp == 1)
{
return (1);
}
else if (tmp == 2)
{
return (2);
}
else if (tmp == 3)
{
return (3);
}
return (4);
}
int main()
{
while(1)
{
ret = Test(1);
PORTB = ret;
}
} |