[Bug c++/91979] Incorrect mangling for non-template-argument nullptr expression

kamleshbhalui at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Oct 22 06:35:00 GMT 2019


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

Kamlesh Kumar <kamleshbhalui at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kamleshbhalui at gmail dot com

--- Comment #2 from Kamlesh Kumar <kamleshbhalui at gmail dot com> ---
This fixes it.

diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index a9333b8..780da9f 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -3400,7 +3400,8 @@ write_template_arg_literal (const tree value)
       case INTEGER_CST:
        gcc_assert (!same_type_p (TREE_TYPE (value), boolean_type_node)
                    || integer_zerop (value) || integer_onep (value));
-       write_integer_cst (value);
+       if (TREE_CODE(TREE_TYPE(value)) != NULLPTR_TYPE)
+         write_integer_cst (value);
        break;

       case REAL_CST:
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index aa78c86..199be43 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -861,7 +861,7 @@ CP_STATIC_IF_GLIBCPP_V3
 int
 cplus_demangle_fill_name (struct demangle_component *p, const char *s, int
len)
 {
-  if (p == NULL || s == NULL || len <= 0)
+  if (p == NULL || s == NULL || len < 0)
     return 0;
   p->d_printing = 0;
   p->type = DEMANGLE_COMPONENT_NAME;


More information about the Gcc-bugs mailing list