diff mbox

[C++] PR 51777

Message ID 4F145A6A.2080702@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Jan. 16, 2012, 5:12 p.m. UTC
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.carlini@oracle.com>

	PR c++/51777
	* c-pretty-print.c (pp_c_integer_constant): For unsigned constants
	use pp_unsigned_wide_integer.

Comments

Jason Merrill Jan. 17, 2012, 3:38 a.m. UTC | #1
OK.

Jason
diff mbox

Patch

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);