From: Mikhail Maltsev Date: Thu, 11 May 2017 10:48:54 +0000 (+0000) Subject: GIMPLEFE: Handle invalid unary "*" operand type X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ac4eb40f5c7069b39eb847a136a1f690bb5444b2;p=gcc.git GIMPLEFE: Handle invalid unary "*" operand type gcc/c/ PR testsuite/80580 * gimple-parser.c (c_parser_gimple_unary_expression): Check argument type of unary '*'. gcc/testsuite/ PR testsuite/80580 * gcc.dg/gimplefe-error-4.c: New test. From-SVN: r247899 --- diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 5d6c6ef2ff2..ac05c3a2b76 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2017-05-11 Mikhail Maltsev + + PR testsuite/80580 + * gimple-parser.c (c_parser_gimple_unary_expression): Check argument + type of unary '*'. + 2017-05-09 Nathan Sidwell * c-tree.h (pushdecl): Declare. diff --git a/gcc/c/gimple-parser.c b/gcc/c/gimple-parser.c index 0d6384b55c2..c6c2f7aa5dc 100644 --- a/gcc/c/gimple-parser.c +++ b/gcc/c/gimple-parser.c @@ -567,6 +567,11 @@ c_parser_gimple_unary_expression (c_parser *parser) op = c_parser_gimple_postfix_expression (parser); if (op.value == error_mark_node) return ret; + if (! POINTER_TYPE_P (TREE_TYPE (op.value))) + { + error_at (op_loc, "expected pointer as argument of unary %<*%>"); + return ret; + } finish = op.get_finish (); location_t combined_loc = make_location (op_loc, op_loc, finish); ret.value = build_simple_mem_ref_loc (combined_loc, op.value); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d7d1d04cb69..dfd8670e8be 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-05-11 Mikhail Maltsev + + PR testsuite/80580 + * gcc.dg/gimplefe-error-4.c: New test. + 2017-05-10 Bill Schmidt * gcc.target/powerpc/p8-vec-xl-xst.c: New file. diff --git a/gcc/testsuite/gcc.dg/gimplefe-error-4.c b/gcc/testsuite/gcc.dg/gimplefe-error-4.c new file mode 100644 index 00000000000..b2ca796656b --- /dev/null +++ b/gcc/testsuite/gcc.dg/gimplefe-error-4.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-fgimple" } */ + +__GIMPLE() void a() +{ + *0 = 1; /* { dg-error "expected pointer" } */ +}