Doomulation
?????????????????????????
I was kinda wondering here...has anyone experienced the compiler optimizing "too much" when using c++? At least the compiler I'm using, as MSVC++.net.
Because I'm having trouble with its over-optimization. Now I don't remember much asm, so I don't really know how to fix it.
The thing is, that the compiler is over optimizing and removing some code used to intialize a structure. At least the bit flag field.
Kindof like this:
According to the assembly generated, the "flags" argument is passed in the cl register. Now, it doesn't save this register, but overwrites it earlier in the function for other purposes. Thus, when it comes to that line, it skips it completly. No code at all.
I was wondering how to fix this.
Perhaps some asm optimization to use another register or push the value to stack somehow? I don't remember how to retrieve data from the stack, however...
Some help would be greatly appreciated.
Because I'm having trouble with its over-optimization. Now I don't remember much asm, so I don't really know how to fix it.
The thing is, that the compiler is over optimizing and removing some code used to intialize a structure. At least the bit flag field.
Kindof like this:
Code:
int fnc(..., byte flags)
{
some_struct struct;
struct.bytefield = someflag1|someflag2|flags; <--- here's the problem
...
}
According to the assembly generated, the "flags" argument is passed in the cl register. Now, it doesn't save this register, but overwrites it earlier in the function for other purposes. Thus, when it comes to that line, it skips it completly. No code at all.
I was wondering how to fix this.
Perhaps some asm optimization to use another register or push the value to stack somehow? I don't remember how to retrieve data from the stack, however...
Some help would be greatly appreciated.