]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/59631 (ICE using _Cilk_spawn without -fcilkplus)
authorBalaji V. Iyer <balaji.v.iyer@intel.com>
Thu, 9 Jan 2014 13:37:41 +0000 (13:37 +0000)
committerBalaji V. Iyer <bviyer@gcc.gnu.org>
Thu, 9 Jan 2014 13:37:41 +0000 (05:37 -0800)
Fix for PR c++/59631.
+++ gcc/cp/ChangeLog
+2014-01-09  Balaji V. Iyer  <balaji.v.iyer@intel.com>
+
+       PR c++/59631
+       * parser.c (cp_parser_postfix_expression): Added a new if-statement
+       and replaced an existing if-statement with else-if statement.
+       Changed an existing error message wording to match the one from the C
+       parser.
+

+++ gcc/testsuite/ChangeLog
+2014-01-09  Balaji V. Iyer  <balaji.v.iyer@intel.com>
+
+       PR c++/59631
+       * gcc.dg/cilk-plus/cilk-plus.exp: Removed "-fcilkplus" from flags list.
+       * g++.dg/cilk-plus/cilk-plus.exp: Likewise.
+       * c-c++-common/cilk-plus/CK/spawnee_inline.c: Replaced second dg-option
+       with dg-additional-options.
+       * c-c++-common/cilk-plus/CK/varargs_test.c: Likewise.
+       * c-c++-common/cilk-plus/CK/steal_check.c: Likewise.
+       * c-c++-common/cilk-plus/CK/spawner_inline.c: Likewise.
+       * c-c++-common/cilk-plus/CK/spawning_arg.c: Likewise.
+       * c-c++-common/cilk-plus/CK/invalid_spawns.c: Added a dg-options tag.
+       * c-c++-common/cilk-plus/CK/pr59631.c: New testcase.
+

gcc/c/ChangeLog
+2014-01-09  Balaji V. Iyer  <balaji.v.iyer@intel.com>
+
+       PR c++/59631
+       * c-parser.c (c_parser_postfix_expression): Replaced consecutive if
+       statements with if-elseif statements.
+

From-SVN: r206463

14 files changed:
gcc/c/ChangeLog
gcc/c/c-parser.c
gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_spawns.c
gcc/testsuite/c-c++-common/cilk-plus/CK/pr59631.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/cilk-plus/CK/spawnee_inline.c
gcc/testsuite/c-c++-common/cilk-plus/CK/spawner_inline.c
gcc/testsuite/c-c++-common/cilk-plus/CK/spawning_arg.c
gcc/testsuite/c-c++-common/cilk-plus/CK/steal_check.c
gcc/testsuite/c-c++-common/cilk-plus/CK/varargs_test.c
gcc/testsuite/g++.dg/cilk-plus/cilk-plus.exp
gcc/testsuite/gcc.dg/cilk-plus/cilk-plus.exp

index 917453b41110a89cedef9e299c6b50175b87ca1c..d3b338a5b8ea14d2b47aeab9f1db969a4ba50fb3 100644 (file)
@@ -1,3 +1,9 @@
+2014-01-09  Balaji V. Iyer  <balaji.v.iyer@intel.com>
+
+       PR c++/59631
+       * c-parser.c (c_parser_postfix_expression): Replaced consecutive if
+       statements with if-elseif statements.
+
 2014-01-06  Marek Polacek  <polacek@redhat.com>
 
        PR c/57773
index f73df0894ba3ca86ecaf69a4d0a5c98fba353ded..44902100bc6995934dde29656414603b8e4a81a6 100644 (file)
@@ -7500,7 +7500,7 @@ c_parser_postfix_expression (c_parser *parser)
              expr = c_parser_postfix_expression (parser);
              expr.value = error_mark_node;           
            }
-         if (c_parser_peek_token (parser)->keyword == RID_CILK_SPAWN)
+         else if (c_parser_peek_token (parser)->keyword == RID_CILK_SPAWN)
            {
              error_at (loc, "consecutive %<_Cilk_spawn%> keywords "
                        "are not permitted");
index b6ee8754c6fee8a76e61edd39d2f0e5591fe9727..9213de72d1b4698ef597e09badd4e03de0808402 100644 (file)
@@ -1,3 +1,11 @@
+2014-01-09  Balaji V. Iyer  <balaji.v.iyer@intel.com>
+
+       PR c++/59631
+       * parser.c (cp_parser_postfix_expression): Added a new if-statement
+       and replaced an existing if-statement with else-if statement.
+       Changed an existing error message wording to match the one from the C
+       parser.
+
 2014-01-08  Jason Merrill  <jason@redhat.com>
 
        PR c++/59614
index 8c615200e54626b422f1398b1921df47c7c16121..c3016bcda4b68d75f2455779f399eda314348208 100644 (file)
@@ -5803,7 +5803,13 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p,
        postfix_expression = 
          cp_parser_postfix_expression (parser, false, false, 
                                        false, false, &idk);
-       if (saved_in_statement & IN_CILK_SPAWN)
+       if (!flag_enable_cilkplus)
+         {
+           error_at (token->location, "-fcilkplus must be enabled to use"
+                     " %<_Cilk_spawn%>");
+           cfun->calls_cilk_spawn = 0;
+         }
+       else if (saved_in_statement & IN_CILK_SPAWN)
          {
            error_at (token->location, "consecutive %<_Cilk_spawn%> keywords "
                      "are not permitted");
@@ -5830,8 +5836,8 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p,
          finish_expr_stmt (sync_expr);
        }
       else
-       error_at (input_location, "_Cilk_sync cannot be used without enabling "
-                 "Cilk Plus");
+       error_at (token->location, "-fcilkplus must be enabled to use" 
+                 " %<_Cilk_sync%>");
       cp_lexer_consume_token (parser->lexer);
       break;
 
index de7990bdfb5e575a78731b6c2afc461dd96e00a5..52d55b8cf1702aa129604e4fe711c789ad9ef7a8 100644 (file)
@@ -1,3 +1,17 @@
+2014-01-09  Balaji V. Iyer  <balaji.v.iyer@intel.com>
+
+       PR c++/59631
+       * gcc.dg/cilk-plus/cilk-plus.exp: Removed "-fcilkplus" from flags list.
+       * g++.dg/cilk-plus/cilk-plus.exp: Likewise.
+       * c-c++-common/cilk-plus/CK/spawnee_inline.c: Replaced second dg-option
+       with dg-additional-options.
+       * c-c++-common/cilk-plus/CK/varargs_test.c: Likewise.
+       * c-c++-common/cilk-plus/CK/steal_check.c: Likewise.
+       * c-c++-common/cilk-plus/CK/spawner_inline.c: Likewise.
+       * c-c++-common/cilk-plus/CK/spawning_arg.c: Likewise.
+       * c-c++-common/cilk-plus/CK/invalid_spawns.c: Added a dg-options tag.
+       * c-c++-common/cilk-plus/CK/pr59631.c: New testcase.
+
 2014-01-09  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/59715
index 90dd5c130b41f9e7fee7ff4e3c205a2bb176d58d..ba9e6193627ebe7438f612130430438e1b83f210 100644 (file)
@@ -1,3 +1,5 @@
+/* { dg-options "-fcilkplus" } */
+
 extern int foo ();
 int bar = _Cilk_spawn foo (); /* { dg-error "may only be used inside a function" } */
 
diff --git a/gcc/testsuite/c-c++-common/cilk-plus/CK/pr59631.c b/gcc/testsuite/c-c++-common/cilk-plus/CK/pr59631.c
new file mode 100644 (file)
index 0000000..389ee7c
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options " " } */  
+
+/* Tests the errors when Cilk keywords are used without -fcilkplus.  */
+
+void foo()
+{
+    _Cilk_spawn foo(); /* { dg-error "must be enabled to use" } */
+}
+
+void foo2 ()
+{
+  _Cilk_spawn foo (); /* { dg-error "must be enabled to use" } */
+  _Cilk_sync; /* { dg-error "must be enabled to use" } */
+}
index 8060c6ceb15cac301583faba23f36132381e4ee7..233a371f140e6a54abf8b63c6f6f8a9a840352e7 100644 (file)
@@ -1,6 +1,6 @@
 /* { dg-do run  { target { i?86-*-* x86_64-*-* } } } */
 /* { dg-options "-fcilkplus -w" } */
-/* { dg-options "-lcilkrts" { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-additional-options "-lcilkrts" { target { i?86-*-* x86_64-*-* } } } */
 
 #include <stdio.h>
 #include <stdlib.h>
index eab9e4206a05eccba8647c8f808bcaa5e0e4d357..55ec223abb3511d371173054c12db5e4584ffddd 100644 (file)
@@ -1,6 +1,6 @@
 /* { dg-do run  { target { i?86-*-* x86_64-*-* } } } */
 /* { dg-options "-fcilkplus" } */
-/* { dg-options "-lcilkrts" { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-additional-options "-lcilkrts" { target { i?86-*-* x86_64-*-* } } } */
 
 #include <stdlib.h>
 #define DEFAULT_VALUE 30
index ac37952837953714ae312cccd666ba9b65ad0d15..95e6cab02c13de0af09a83bed3358398e9fe48ed 100644 (file)
@@ -1,6 +1,6 @@
 /* { dg-do run  { target { i?86-*-* x86_64-*-* } } } */
 /* { dg-options "-fcilkplus" } */
-/* { dg-options "-lcilkrts" { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-additional-options "-lcilkrts" { target { i?86-*-* x86_64-*-* } } } */
 
 void f0(volatile int *steal_flag)
 { 
index 21d6797857dcdd5864f374390a1bf444556642a6..6e2876531c3a412b4f84d7782cc838d712d2977b 100644 (file)
@@ -1,6 +1,6 @@
 /* { dg-do run  { target { i?86-*-* x86_64-*-* } } } */
 /* { dg-options "-fcilkplus" } */
-/* { dg-options "-lcilkrts" { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-additional-options "-lcilkrts" { target { i?86-*-* x86_64-*-* } } } */
 
 // #include <cilk/cilk_api.h>
 extern void __cilkrts_set_param (char *, char *);
index ab5d63a3f4c635005d7931394bd7dab7a3c8a2c5..2714600244090f2aa48e48697478acdb686210ce 100644 (file)
@@ -1,6 +1,6 @@
 /* { dg-do run  { target { i?86-*-* x86_64-*-* } } } */
 /* { dg-options "-fcilkplus" } */
-/* { dg-options "-lcilkrts" { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-additional-options "-lcilkrts" { target { i?86-*-* x86_64-*-* } } } */
 
 #include <stdarg.h>
 #include <stdlib.h>
index e201fd227cfd4e19b6587bddb6a5334fb2a2bf94..fc353f53e6298feb40e8c93c1b080b6e353d06a3 100644 (file)
@@ -74,12 +74,12 @@ dg-runtest [lsort [glob -nocomplain $srcdir/g++.dg/cilk-plus/CK/*.cc]] " -g -O3
 dg-finish
 
 dg-init
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " -fcilkplus" " "
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " -O1 -fcilkplus" " "
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " -O2 -fcilkplus" " "
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " -O3 -fcilkplus" " "
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " -g -fcilkplus" " "
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " -g -O2 -fcilkplus" " "
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " -g -O3 -fcilkplus" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " " " "
+dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " -O1 " " "
+dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " -O2 " " "
+dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " -O3 " " "
+dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " -g " " "
+dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " -g -O2 " " "
+dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " -g -O3 " " "
 dg-finish
 unset TEST_EXTRA_LIBS
index c370ec645e6a0e976bd74893f22dcd9dccbbf54a..c80baf956708e865eac8a2f5420a47aab13cba1a 100644 (file)
@@ -51,13 +51,13 @@ dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/AN/*.c]] " -f
 dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/AN/*.c]] " -fcilkplus -O3 -std=c99" " "
 dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/AN/*.c]] " -fcilkplus -g -O0 -std=c99" " "
 
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " -g -fcilkplus" " "
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " -O1 -fcilkplus" " "
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " -O2 -std=c99 -fcilkplus" " "
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " -O2 -ftree-vectorize -fcilkplus" " "
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " -O3 -g -fcilkplus" " "
+dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " -g " " "
+dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " -O1 " " "
+dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " -O2 -std=c99 " " "
+dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " -O2 -ftree-vectorize " " "
+dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " -O3 -g " " "
 if { [check_effective_target_lto] } {
-    dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " -O3 -flto -g -fcilkplus" " "
+    dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/CK/*.c]] " -O3 -flto -g " " "
 }
 
 dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cilk-plus/SE/*.c]] " -g" " "
This page took 0.117202 seconds and 5 git commands to generate.