aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Zamyatin <igor.zamyatin@intel.com>2014-05-21 08:03:06 +0000
committerKirill Yukhin <kyukhin@gcc.gnu.org>2014-05-21 08:03:06 +0000
commitc3d96270fc4d1f16fbb905049e16cf39152c9baa (patch)
tree0e08ace796b1643576b572dcd7aa5793aff3bd73
parent3aaf05290aeed9682334510fa38886338b64ad73 (diff)
downloadgcc-c3d96270fc4d1f16fbb905049e16cf39152c9baa.zip
gcc-c3d96270fc4d1f16fbb905049e16cf39152c9baa.tar.gz
gcc-c3d96270fc4d1f16fbb905049e16cf39152c9baa.tar.bz2
re PR c++/60189 (ICE with invalid use of _Cilk_sync)
gcc/cp PR c/60189 * parser.c (cp_parser_postfix_expression): Move handling of cilk_sync from here to... (cp_parser_statement): ...here. Make sure only semicolon can go after Cilk_sync. gcc/testsuite PR c++/60189 * c-c++-common/cilk-plus/CK/invalid_sync.cÑ: New test. From-SVN: r210678
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/parser.c32
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_sync.cc9
4 files changed, 40 insertions, 14 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index fb0d335..790b87e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,11 @@
+2014-05-21 Igor Zamyatin <igor.zamyatin@intel.com>
+
+ PR c/60189
+ * parser.c (cp_parser_postfix_expression): Move handling of cilk_sync
+ from here to...
+ (cp_parser_statement): ...here. Make sure only semicolon can go after
+ Cilk_sync.
+
2014-05-20 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58753
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index d6bb518..7f06106 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -5845,20 +5845,6 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p,
}
break;
}
-
- case RID_CILK_SYNC:
- if (flag_cilkplus)
- {
- tree sync_expr = build_cilk_sync ();
- SET_EXPR_LOCATION (sync_expr,
- cp_lexer_peek_token (parser->lexer)->location);
- finish_expr_stmt (sync_expr);
- }
- else
- error_at (token->location, "-fcilkplus must be enabled to use"
- " %<_Cilk_sync%>");
- cp_lexer_consume_token (parser->lexer);
- break;
case RID_BUILTIN_SHUFFLE:
{
@@ -9414,6 +9400,24 @@ cp_parser_statement (cp_parser* parser, tree in_statement_expr,
statement = cp_parser_jump_statement (parser);
break;
+ case RID_CILK_SYNC:
+ cp_lexer_consume_token (parser->lexer);
+ if (flag_cilkplus)
+ {
+ tree sync_expr = build_cilk_sync ();
+ SET_EXPR_LOCATION (sync_expr,
+ token->location);
+ statement = finish_expr_stmt (sync_expr);
+ }
+ else
+ {
+ error_at (token->location, "-fcilkplus must be enabled to use"
+ " %<_Cilk_sync%>");
+ statement = error_mark_node;
+ }
+ cp_parser_require (parser, CPP_SEMICOLON, RT_SEMICOLON);
+ break;
+
/* Objective-C++ exception-handling constructs. */
case RID_AT_TRY:
case RID_AT_CATCH:
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 117c65f..a5d155c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-05-21 Igor Zamyatin <igor.zamyatin@intel.com>
+
+ PR c++/60189
+ * c-c++-common/cilk-plus/CK/invalid_sync.cÑ: New test.
+
2014-05-20 Jan Hubicka <hubicka@ucw.cz>
PR tree-optimization/60899
diff --git a/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_sync.cc b/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_sync.cc
new file mode 100644
index 0000000..cf1caf1
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_sync.cc
@@ -0,0 +1,9 @@
+/* PR c/60189 */
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+int main (void)
+{
+ _Cilk_sync return; /* { dg-error " expected ';' before 'return'" } */
+ return 0;
+}