why optimization does not happen?
- by aaa
hi.
I have C/C++ code, that looks like this:
static int function(double *I) {
int n = 0;
// more instructions, loops,
for (int i; ...; ++i)
n += fabs(I[i] > tolerance);
return n;
}
function(I); // return value is not used.
compiler inlines function, however it does not optimize out n manipulations.
I would expect compiler is able to recognize that value is never used as rhs only.
Is there some side effect, which prevents optimization?
Thanks