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 c++/70909] Libiberty Demangler segfaults (4)


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

--- Comment #37 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
(In reply to Mark Wielaard from comment #36)
> Does any of them handle the one from PR67738:
> _ZNK6Common15ConvertingRangeIN5boost12range_detail17transformed_rangeIZN1a1b1
> cEbEUljE_KSt6vectorIjSaIjEEEEEcvT_IS7_INS4_1dESaISF_EEEEv

Yes libcxxabi does.

(you could easily check this yourself:

 % git clone https://llvm.googlesource.com/libcxxabi
 % cd libcxxabi

(then apply this patch):

 diff --git a/src/cxa_demangle.cpp b/src/cxa_demangle.cpp
index c48883221290..1d188133b7f9 100644
--- a/src/cxa_demangle.cpp
+++ b/src/cxa_demangle.cpp
@@ -19,6 +19,7 @@
 #include <cstdlib>
 #include <cstring>
 #include <cctype>
+#include <iostream>

 #ifdef _MSC_VER
 // snprintf is implemented in VS 2015
@@ -5041,3 +5042,12 @@ __cxa_demangle(const char *mangled_name, char *buf,
size_t *n, int *status) {
 }

 }  // __cxxabiv1
+
+int
+main(int argc, char** argv) {
+    for (int i = 1, status = 0; i < argc; ++i)
+    {
+        char* dm = __cxxabiv1::__cxa_demangle(argv[i], NULL, NULL, &status);
+        std::cout << (status ? argv[i] : dm) << "\n";
+    }
+}

 % cd src
 % g++ -O2 -I../include cxa_demangle.cpp -o c++filt__
)

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