https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121159

            Bug ID: 121159
           Summary: [[noreturn]] pessimizes code size and performance
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: antoshkka at gmail dot com
  Target Milestone: ---

Consider the example:

[[noreturn]] void abort_like() noexcept;
void just_void() noexcept;

void test1() { abort_like(); }
void test2() { just_void(); }


Calling a function without `[[noreturn]]` results in just a `jmp`. Function
with `[[noreturn]]` additionally touches `rsp` and uses `call`:

"test1()":
        sub     rsp, 8
        call    "abort_like()"
"test2()":
        jmp     "just_void()"


Godbolt playground: https://godbolt.org/z/6xfn76e81

Reply via email to