You can use custom optimization at function level using attribute:
Or at function/file level using pragma:https://interrupt.memfault.com/blog/cod ... -gcc-flags
In your case it would be "O0": https://gcc.gnu.org/onlinedocs/gcc/Opti ... tions.html
6.4.1 Common Attributes: https://gcc.gnu.org/onlinedocs/gcc/Comm ... x-optimize
6.5.15 Function Specific Option Pragmas: https://gcc.gnu.org/onlinedocs/gcc/Func ... agmas.html
Code:
void __attribute__((optimize("O3"))) fast_function(void) { // ...}Or at function/file level using pragma:
Code:
#pragma GCC push_options#pragma GCC optimize ("O3")/* * Code that needs optimizing */#pragma GCC pop_optionsIn your case it would be "O0": https://gcc.gnu.org/onlinedocs/gcc/Opti ... tions.html
6.4.1 Common Attributes: https://gcc.gnu.org/onlinedocs/gcc/Comm ... x-optimize
6.5.15 Function Specific Option Pragmas: https://gcc.gnu.org/onlinedocs/gcc/Func ... agmas.html
Statistics: Posted by gmx — Tue May 12, 2026 11:48 pm





