aboutsummaryrefslogtreecommitdiff
path: root/gcc/c/gimple-parser.c
diff options
context:
space:
mode:
authorMikhail Maltsev <maltsevm@gmail.com>2017-05-11 10:55:52 +0000
committerMikhail Maltsev <miyuki@gcc.gnu.org>2017-05-11 10:55:52 +0000
commit67ac9a9db1b63e93fcdc2d959325c984edd521b8 (patch)
tree5e09d07bcfd1c2075674e81871599ea928b5eb77 /gcc/c/gimple-parser.c
parentac4eb40f5c7069b39eb847a136a1f690bb5444b2 (diff)
downloadgcc-67ac9a9db1b63e93fcdc2d959325c984edd521b8.zip
gcc-67ac9a9db1b63e93fcdc2d959325c984edd521b8.tar.gz
gcc-67ac9a9db1b63e93fcdc2d959325c984edd521b8.tar.bz2
GIMPLEFE: handle invalid __MEM
gcc/c/ PR testsuite/80580 * gimple-parser.c (c_parser_gimple_postfix_expression): Handle incorrect __MEM syntax. gcc/testsuite/ PR testsuite/80580 * gcc.dg/gimplefe-error-5.c: New test. From-SVN: r247900
Diffstat (limited to 'gcc/c/gimple-parser.c')
-rw-r--r--gcc/c/gimple-parser.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/c/gimple-parser.c b/gcc/c/gimple-parser.c
index c6c2f7a..c0858b7 100644
--- a/gcc/c/gimple-parser.c
+++ b/gcc/c/gimple-parser.c
@@ -804,6 +804,16 @@ c_parser_gimple_postfix_expression (c_parser *parser)
}
}
ptr = c_parser_gimple_unary_expression (parser);
+ if (ptr.value == error_mark_node
+ || ! POINTER_TYPE_P (TREE_TYPE (ptr.value)))
+ {
+ if (ptr.value != error_mark_node)
+ error_at (ptr.get_start (),
+ "invalid type of %<__MEM%> operand");
+ c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
+ "expected %<)%>");
+ return expr;
+ }
if (! alias_type)
alias_type = TREE_TYPE (ptr.value);
/* Optional constant offset. */