Mystic bahaviour of eclipse when chanding from release to debug

I have made a project using netos71 and eclipse.
The project compiles with no error and warnings in debug mode and the program is working.
When changing to release mode, a lot of stupid warnings are generated. Some of them are obviously wrong, f. ex. the warning “'i’might be used unintialized in this function”
and the code is:
int i;
i = 1;

Have anyone a solution to this problem?

Never heard of this before. Do you have the build output and the code that’s generating the errors?

It seems to be the code optimizer that is generating the warnings. If I change the level from O2 to O0 (same level as in debug-mode) the warnings disappears. The program seems to work with all the warnings, in my case 41. I have not changed anything in the build setup in Eclipse from the standard setup, when I start a new project with new->Start OS project except from the network parameters.
Together with other 40 warnings generated by the smidump program about unused variables (there are really unused - there are placed in the functions used to generate SNMP notifications) I gets a total of 81 warnings. It is easy to overlook an important warning.
The solution I have used now is to uncomment the unused variables, test the program in debug-mode, change to release-mode and discard all the warnings that seems to be pure nonsence.