diff options
author | Richard Biener <rguenther@suse.de> | 2017-01-13 08:16:59 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2017-01-13 08:16:59 +0000 |
commit | 2532991330bb47ab45c099ad54681e3e1a0981a3 (patch) | |
tree | ff747237c5c0afc4668ec0dcff4a7b37a6310112 /gcc/c | |
parent | 10b70b8e5eb8d4b5ab175785366cfc6cbe837390 (diff) | |
download | gcc-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/c')
-rw-r--r-- | gcc/c/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c/gimple-parser.c | 26 |
2 files changed, 31 insertions, 0 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 65531aa..fd6f74b 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2017-01-13 Richard Biener <rguenther@suse.de> + + * gimple-parser.c (c_parser_gimple_postfix_expression): Parse + _Literal ( type-name ) number. + 2017-01-12 Richard Biener <rguenther@suse.de> * gimple-parser.c (c_parser_gimple_postfix_expression): Parse diff --git a/gcc/c/gimple-parser.c b/gcc/c/gimple-parser.c index ee8a01a..927c685 100644 --- a/gcc/c/gimple-parser.c +++ b/gcc/c/gimple-parser.c @@ -799,6 +799,32 @@ c_parser_gimple_postfix_expression (c_parser *parser) type, ptr.value, alias_off); break; } + else if (strcmp (IDENTIFIER_POINTER (id), "_Literal") == 0) + { + /* _Literal '(' type-name ')' number */ + c_parser_consume_token (parser); + tree type = NULL_TREE; + if (c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>")) + { + struct c_type_name *type_name = c_parser_type_name (parser); + tree tem; + if (type_name) + type = groktypename (type_name, &tem, NULL); + c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, + "expected %<)%>"); + } + tree val = c_parser_gimple_postfix_expression (parser).value; + if (! type + || ! val + || val == error_mark_node + || TREE_CODE (val) != INTEGER_CST) + { + c_parser_error (parser, "invalid _Literal"); + return expr; + } + expr.value = fold_convert (type, val); + return expr; + } /* SSA name. */ unsigned version, ver_offset; if (! lookup_name (id) |