aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-pretty-print.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-01-13 08:16:59 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2017-01-13 08:16:59 +0000
commit2532991330bb47ab45c099ad54681e3e1a0981a3 (patch)
treeff747237c5c0afc4668ec0dcff4a7b37a6310112 /gcc/tree-pretty-print.c
parent10b70b8e5eb8d4b5ab175785366cfc6cbe837390 (diff)
downloadgcc-2532991330bb47ab45c099ad54681e3e1a0981a3.zip
gcc-2532991330bb47ab45c099ad54681e3e1a0981a3.tar.gz
gcc-2532991330bb47ab45c099ad54681e3e1a0981a3.tar.bz2
gimple-parser.c (c_parser_gimple_postfix_expression): Parse _Literal ( type-name ) number.
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. From-SVN: r244393
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 87b4044..ebce67e 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;