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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|-Og generates empty         |generates empty functions
                   |functions with              |with
                   |.cfi_startproc/.cfi_endproc |.cfi_startproc/.cfi_endproc
                   |that conflict with other    |that conflict with other
                   |functions                   |functions
          Component|c++                         |middle-end
            Version|unknown                     |13.0

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
I'm quite sure we dont "remove" any such empty functions with -O2, we might
more aggressively inline and thus if they are static they will be elided.

But the "problem" if there is any, should be generic.

void foo () { __builtin_unreachable (); }
int __attribute__((cold)) bar () { return 0; }

compiled with -O2 gets you the following where foo and bar have the same
address.

        .section        .text.unlikely,"ax",@progbits
        .globl  foo
        .type   foo, @function
foo:
.LFB0:
        .file 1 "t.i"
        .loc 1 1 13 view -0
        .cfi_startproc
        .loc 1 1 15 view .LVU1
        .cfi_endproc
.LFE0:
        .size   foo, .-foo
        .globl  bar
        .type   bar, @function
bar:
.LFB1:
        .loc 1 2 34 view -0
        .cfi_startproc
        .loc 1 2 36 view .LVU3
        .loc 1 2 46 is_stmt 0 view .LVU4
        xorl    %eax, %eax
        ret
        .cfi_endproc
.LFE1:
        .size   bar, .-bar

Reply via email to