This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] c/61271 fix ICE for invalid cilkplus array notation

On 21/05/14 16:43 +0100, Jonathan Wakely wrote:
This is only one of several cases in the PR, but one that's simple
enough for me to write a test for and fix.

Tested x86_64-linux, OK for trunk?

There's a separate PR for this one now:

So I'll update the ChangeLog entries to c++/61276 if it's approved.

commit 3ddcc29423746afb348c15160d33d3b1eec6fe12
Author: Jonathan Wakely <>
Date:   Wed May 21 16:20:25 2014 +0100

   	PR c/61271
   	* cp-array-notation.c (cilkplus_an_triplet_types_ok_p): Fix condition.
   	PR c/61271
   	* g++.dg/cilk-plus/AN/ New.

diff --git a/gcc/cp/cp-array-notation.c b/gcc/cp/cp-array-notation.c
index 0ff0967..ff82dee 100644
--- a/gcc/cp/cp-array-notation.c
+++ b/gcc/cp/cp-array-notation.c
@@ -26,7 +26,7 @@
   An array notation expression has 4 major components:
   1. The array name
   2. Start Index
-   3. Number of elements we need to acess (we call it length)
+   3. Number of elements we need to access (we call it length)
   4. Stride

   So, if we have something like A[0:5:2], we are accessing A[0], A[2], A[4],
@@ -1418,7 +1418,7 @@ cilkplus_an_triplet_types_ok_p (location_t loc, tree start_index, tree length,
      error_at (loc, "stride of array notation triplet is not an integer");
      return false;
-  if (!TREE_CODE (type) == FUNCTION_TYPE)
+  if (TREE_CODE (type) == FUNCTION_TYPE)
      error_at (loc, "array notation cannot be used with function type");
      return false;
diff --git a/gcc/testsuite/g++.dg/cilk-plus/AN/ b/gcc/testsuite/g++.dg/cilk-plus/AN/
new file mode 100644
index 0000000..b111e21
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cilk-plus/AN/
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+void f() { }
+int main()
+  f[0:1:1];  // { dg-error "function type" }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]