This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/77342] New: Use abi_tag on Debug Mode namespace


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

            Bug ID: 77342
           Summary: Use abi_tag on Debug Mode namespace
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

The libstdc++ Debug Mode changes the ABI of various types, requiring all
affected code to be recompiled. If some function is not recompiled, and the
debug mode type doesn't appear in its mangled name, then you get undefined
behaviour, typically resulting in runtime crashes, e.g. PR 77340.

If we used the abi_tag attribute on the inline namespace used for Debug Mode
components then it would turn run-time crashes into linker errors, or at least
warnings when a data member of a class changes size.

e.g. with:

  // Inline namespace for debug mode.
# ifdef _GLIBCXX_DEBUG
  inline namespace __debug __attribute__((__abi_tag__("__debug"))) { }
# endif

the code in PR 77340 fails to link:

/tmp/cccmvLXH.o: In function `main':
/tmp/main.cpp:4: undefined reference to `func()'
collect2: error: ld returned 1 exit status

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]