]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/58942 (cilkplus internal compiler error: tree check __sec_reduce_max_ind)
authorIgor Zamyatin <igor.zamyatin@intel.com>
Wed, 4 Jun 2014 10:07:21 +0000 (10:07 +0000)
committerKirill Yukhin <kyukhin@gcc.gnu.org>
Wed, 4 Jun 2014 10:07:21 +0000 (10:07 +0000)
gcc/c/
PR c/58942
* c-array-notation.c (fix_builtin_array_notation_fn): Handle the case
with a pointer.

gcc/cp/
PR c/58942
* cp-array-notation.c (expand_sec_reduce_builtin): Handle the case
with a pointer.

gcc/testsuite/
PR c/58942
* c-c++-common/cilk-plus/AN/pr58942.c: Check for correct handling of
the case with a pointer.

From-SVN: r211220

gcc/c/ChangeLog
gcc/c/c-array-notation.c
gcc/cp/ChangeLog
gcc/cp/cp-array-notation.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/cilk-plus/AN/pr58942.c [new file with mode: 0644]

index 1047a65b636d698fe68f8465fa818153cfffc1a1..c51bfb49580dcb3fd0832415eb58d75dcbcdefa2 100644 (file)
@@ -1,3 +1,9 @@
+2014-06-04  Igor Zamyatin  <igor.zamyatin@intel.com>
+
+       PR c/58942
+       * c-array-notation.c (fix_builtin_array_notation_fn): Handle the case
+       with a pointer.
+
 2014-06-03  Marek Polacek  <polacek@redhat.com>
 
        PR c/60439
index a0fe2fbbee8d362f913d11867881f3b66526deb9..b4015b84ee92009d34a0d6eb1829f2b3bb0aa0f1 100644 (file)
@@ -310,7 +310,9 @@ fix_builtin_array_notation_fn (tree an_builtin_fn, tree *new_var)
       || an_type == BUILT_IN_CILKPLUS_SEC_REDUCE_MIN_IND)
     array_ind_value = build_decl (location, VAR_DECL, NULL_TREE, 
                                  TREE_TYPE (func_parm));
-  array_op0 = (*array_operand)[0];                           
+  array_op0 = (*array_operand)[0];
+  if (TREE_CODE (array_op0) == INDIRECT_REF)
+    array_op0 = TREE_OPERAND (array_op0, 0);
   switch (an_type)
     {
     case BUILT_IN_CILKPLUS_SEC_REDUCE_ADD:
index 9a22842bf17e4bad21672b6f929989ff2451728b..334d6b1f3c46aa859b56de0b731c707c1d7327f0 100644 (file)
@@ -1,3 +1,9 @@
+2014-06-04  Igor Zamyatin  <igor.zamyatin@intel.com>
+
+       PR c/58942
+       * cp-array-notation.c (expand_sec_reduce_builtin): Handle the case
+       with a pointer.
+
 2014-06-03  Paolo Carlini  <paolo.carlini@oracle.com>
 
        DR 1423
index ff82deee7be57244b6dc5087940fa15ba1a671af..0538e559f85339d8b904d89b84ad32a8d4a7bbf7 100644 (file)
@@ -340,6 +340,8 @@ expand_sec_reduce_builtin (tree an_builtin_fn, tree *new_var)
     array_ind_value = get_temp_regvar (TREE_TYPE (func_parm), func_parm);
 
   array_op0 = (*array_operand)[0];
+  if (TREE_CODE (array_op0) == INDIRECT_REF)
+    array_op0 = TREE_OPERAND (array_op0, 0);
   switch (an_type)
     {
     case BUILT_IN_CILKPLUS_SEC_REDUCE_ADD:
index f1878b6dece4613129d71c3f0d30ad61edee0bdb..4146bde92b7d8eaf178467eb6f1c75cfba0431b0 100644 (file)
@@ -1,3 +1,9 @@
+2014-06-04  Igor Zamyatin  <igor.zamyatin@intel.com>
+
+       PR c/58942
+       * c-c++-common/cilk-plus/AN/pr58942.c: Check for correct handling of
+       the case with a pointer.
+
 2014-06-04  Marek Polacek  <polacek@redhat.com>
 
        PR c/30020
diff --git a/gcc/testsuite/c-c++-common/cilk-plus/AN/pr58942.c b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr58942.c
new file mode 100644 (file)
index 0000000..87903af
--- /dev/null
@@ -0,0 +1,8 @@
+/* PR c/58942 */
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+int foo (int*p, int i)
+{
+  return __sec_reduce_max_ind(p[1:i]);
+}