[Bug libstdc++/105810] New: __glibcxx_assert can be improved greatly.

unlvsur at live dot com gcc-bugzilla@gcc.gnu.org
Wed Jun 1 21:31:28 GMT 2022


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

            Bug ID: 105810
           Summary: __glibcxx_assert can be improved greatly.
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: unlvsur at live dot com
  Target Milestone: ---

Every function call has to carry the call which adds a burden. With -Os the
function does not even get expanded. The operator[] becomes extremely
expensive.
https://godbolt.org/z/Gcchdrdxj

The situation might get worse when compiling with -fPIC since load/store data
from %rip register needs more instructions.

It can be improved to something like this. Put all the file, line, and
condition information into a separate function. Since the function is an inline
function, the entire program only holds one copy of the debugging information.
https://godbolt.org/z/xc8jnqh5r


https://godbolt.org/z/85M1PE9Te
vs
https://godbolt.org/z/6fsGo41bj


Unfortunately, GCC got ICE. I have submitted the bug report to fix that.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105809


More information about the Gcc-bugs mailing list