Ho to instruct the optimizer to not throw out certain constructs

Hi Mats,

thanks for your reply. Basically I want to implement some defensive actions against unauthorized code changes. The artifical introduced variables are used in a specifc manner and should be left untouched
by the optimizer.

One very basic and simplistic example:

Original code:

res = foo(a);

Did you mean *res0 = 1, *res1 = 1?

And you do realize that for anything that is worth reverse engineering, this will just add a few minutes to someones time when trying to reverse engineer/bypass your code?

Obviously, if the compiler decides to inline foo, and then you haven’t got a use for *res0 and *res1, it will still just optimise it away.

Yep that’s what I mean. As I said this is a very simplistic example. Reverse or bypass certain code areas is just one topic. The other equally imported is fault-tolerance.
The open question is how to define a set of objects and tell the optimizer
to leave them untouched.