aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-pretty-print.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2017-01-13 08:16:59 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2017-01-13 08:16:59 +0000
commitac5f04c1c9a5a81c1c443d6d827ed1b4a25fb108 (patch)
treeff747237c5c0afc4668ec0dcff4a7b37a6310112 /gcc/tree-pretty-print.c
parent1e74686cf3ad2dbc1dbb55893eb8aa6b4932e423 (diff)
2017-01-13 Richard Biener <rguenther@suse.de>
c/ * gimple-parser.c (c_parser_gimple_postfix_expression): Parse _Literal ( type-name ) number. * tree-pretty-print.c (dump_generic_node): Dump INTEGER_CSTs as _Literal ( type ) number in case usual suffixes do not preserve all information. * gcc.dg/gimplefe-22.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244393 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-pretty-print.c')
-rw-r--r--gcc/tree-pretty-print.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index 87b404475ee..ebce67ec3e1 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -1664,6 +1664,16 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, int flags,
break;
case INTEGER_CST:
+ if (flags & TDF_GIMPLE
+ && (POINTER_TYPE_P (TREE_TYPE (node))
+ || (TYPE_PRECISION (TREE_TYPE (node))
+ < TYPE_PRECISION (integer_type_node))
+ || exact_log2 (TYPE_PRECISION (TREE_TYPE (node))) == -1))
+ {
+ pp_string (pp, "_Literal (");
+ dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
+ pp_string (pp, ") ");
+ }
if (TREE_CODE (TREE_TYPE (node)) == POINTER_TYPE
&& ! (flags & TDF_GIMPLE))
{
@@ -1693,11 +1703,7 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, int flags,
else if (tree_fits_shwi_p (node))
pp_wide_integer (pp, tree_to_shwi (node));
else if (tree_fits_uhwi_p (node))
- {
- pp_unsigned_wide_integer (pp, tree_to_uhwi (node));
- if (flags & TDF_GIMPLE)
- pp_character (pp, 'U');
- }
+ pp_unsigned_wide_integer (pp, tree_to_uhwi (node));
else
{
wide_int val = node;
@@ -1710,6 +1716,24 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, int flags,
print_hex (val, pp_buffer (pp)->digit_buffer);
pp_string (pp, pp_buffer (pp)->digit_buffer);
}
+ if ((flags & TDF_GIMPLE)
+ && (POINTER_TYPE_P (TREE_TYPE (node))
+ || (TYPE_PRECISION (TREE_TYPE (node))
+ < TYPE_PRECISION (integer_type_node))
+ || exact_log2 (TYPE_PRECISION (TREE_TYPE (node))) == -1))
+ {
+ if (TYPE_UNSIGNED (TREE_TYPE (node)))
+ pp_character (pp, 'u');
+ if (TYPE_PRECISION (TREE_TYPE (node))
+ == TYPE_PRECISION (unsigned_type_node))
+ ;
+ else if (TYPE_PRECISION (TREE_TYPE (node))
+ == TYPE_PRECISION (long_unsigned_type_node))
+ pp_character (pp, 'l');
+ else if (TYPE_PRECISION (TREE_TYPE (node))
+ == TYPE_PRECISION (long_long_unsigned_type_node))
+ pp_string (pp, "ll");
+ }
if (TREE_OVERFLOW (node))
pp_string (pp, "(OVF)");
break;