https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121973
--- Comment #5 from Vincenzo Romano <vincenzo.romano at gmail dot com> --- I would say that "naked" functions should never go through any optimizer, by design, as they only contain hand crafted assembly code (marked as volatile in my case). All optimizations (-O1 to -O3 and -Os) actually work fine. Only -O0 triggers the extra code emission.