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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is because of the way inline have different semantics between the two
langauges.

If I change TSFastDbg to be static instead of just inline, then the code
emitted is the same.
In the case of C, since TSFastDbg is not inlined, there exists an out of line
version of it in a different TU.
In the case of C++, TSFastDbg has vague linkage, there for will be emitted but
in a comdat section.

The options you have turned on for godbolt, hide this fact; turning them off
you get:

.Ltext0:
        .section       
.text._Z9TSFastDbgP14TSFastDbgCntl_PKcz,"axG",@progbits,_Z9TSFastDbgP14TSFastDbgCntl_PKcz,comdat
        .p2align 4,,15
        .weak   _Z9TSFastDbgP14TSFastDbgCntl_PKcz
        .type   _Z9TSFastDbgP14TSFastDbgCntl_PKcz, @function
_Z9TSFastDbgP14TSFastDbgCntl_PKcz:

See how that is a comdat section.

Reply via email to