I have noticed that I get error messages or I don't sometimes depending on optimization level. For example, I had a statement that tried to store a value into code space and at opt level zero, I got an error saying that it couldn't convert the lvalue. I understood this. However, at opt level 8, I got no error and in fact the 'optimizer' simply left out the offending line. Why should it do this? If it is an error, it should report it and not throw the code away.
If the line of code did nothing, the compiler, any optimizing compiler will remove it. I leave opimization on the highest level at all times.
If a line of code does nothing then certainly it would be optimized out. However, my big concern is that it was supposed to do something but there was an error in the line. I feel that the compiler should have reported the error and not simply removed the line without saying anything. I could have spent a looooong time debugging, wondering why that particular function didn't work properly.
Can you show us the error?
View all questions in Keil forum