I am working on a project that relies on compiler optimisations but I need some code not to be optimised by GCC. Is this possible?
GCC 4.4 has an attribute for that:
int foo(int i) __attribute__((optimize("-O3")));
It is documented at: https://gcc.gnu.org/onlinedocs/gcc-5.1.0/gcc/Function-Attributes.html#index-g_t_0040code_007boptimize_007d-function-attribute-3195
2.1m questions
2.1m answers
60 comments
57.0k users