Hi,

in this diagnostic issue we incorrectly print unsigned template arguments as signed. The fix seems straightforward: just use the very same algorithm used in dump_generic_node for INTEGER_CST, thus dispatch to either pp_wide_integer or pp_unsigned_wide_integer.

Booted and tested C++ (testing in progress for C etc.)

Ok for mainline?

Thanks,
Paolo.

///////////////////////
2012-01-16  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/51777
        * c-pretty-print.c (pp_c_integer_constant): For unsigned constants
        use pp_unsigned_wide_integer.
Index: c-pretty-print.c
===================================================================
--- c-pretty-print.c    (revision 183211)
+++ c-pretty-print.c    (working copy)
@@ -910,8 +910,10 @@ pp_c_integer_constant (c_pretty_printer *pp, tree
     ? TYPE_CANONICAL (TREE_TYPE (i))
     : TREE_TYPE (i);
 
-  if (TREE_INT_CST_HIGH (i) == 0)
+  if (host_integerp (i, 0))
     pp_wide_integer (pp, TREE_INT_CST_LOW (i));
+  else if (host_integerp (i, 1))
+    pp_unsigned_wide_integer (pp, TREE_INT_CST_LOW (i));
   else
     {
       unsigned HOST_WIDE_INT low = TREE_INT_CST_LOW (i);

Reply via email to