re PR other/61962 (GCC seems to enter an infinite loop when compiling the above cilk...
authorIgor Zamyatin <igor.zamyatin@intel.com>
Tue, 12 Aug 2014 12:27:41 +0000 (12:27 +0000)
committerKirill Yukhin <kyukhin@gcc.gnu.org>
Tue, 12 Aug 2014 12:27:41 +0000 (12:27 +0000)
PR other/61962

gcc/c-family/
        * array-notation-common.c (find_rank): Added handling for other
        types of references.

testsuite/
        * c-c++-common/cilk-plus/AN/pr61962.c: New test.

From-SVN: r213858

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

index e71f6edd2b8c5df9a34a335c764f10d5701e12d2..269c6a16f43698b869b4b2c9f115c86630386f78 100644 (file)
@@ -1,3 +1,9 @@
+2014-08-12  Igor Zamyatin  <igor.zamyatin@intel.com>
+
+       PR other/61962
+       * array-notation-common.c (find_rank): Added handling for other
+       types of references.
+
 2014-08-10  Marek Polacek  <polacek@redhat.com>
 
        PR c/51849
index 84f6f452799487a0534ad9aa523ab00e798dd749..f8bce04bbc1e7e7efa1d95793790abd12008564e 100644 (file)
@@ -221,11 +221,14 @@ find_rank (location_t loc, tree orig_expr, tree expr, bool ignore_builtin_fn,
              current_rank++;
              ii_tree = ARRAY_NOTATION_ARRAY (ii_tree);
            }
-         else if (TREE_CODE (ii_tree) == ARRAY_REF)
+         else if (handled_component_p (ii_tree)
+                  || TREE_CODE (ii_tree) == INDIRECT_REF)
            ii_tree = TREE_OPERAND (ii_tree, 0);
          else if (TREE_CODE (ii_tree) == PARM_DECL
                   || TREE_CODE (ii_tree) == VAR_DECL)
            break;
+         else
+           gcc_unreachable ();
        }
       if (*rank == 0)
        /* In this case, all the expressions this function has encountered thus
index 70d0653fd1488c9a229afdb28098eb4d9a3305e0..260013b5d1a0956ac1ef40ac98137a8d928b493a 100644 (file)
@@ -1,3 +1,8 @@
+2014-08-12  Igor Zamyatin  <igor.zamyatin@intel.com>
+
+       PR other/61962
+       * c-c++-common/cilk-plus/AN/pr61962.c: New test.
+
 2014-08-12  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
        PR middle-end/62103
diff --git a/gcc/testsuite/c-c++-common/cilk-plus/AN/pr61962.c b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr61962.c
new file mode 100644 (file)
index 0000000..08d4fe2
--- /dev/null
@@ -0,0 +1,14 @@
+/* PR other/61962 */
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+struct FloatStruct
+{
+    float *f;
+};
+
+/* Either SRC or DST must be a struct, otherwise the bug does not occur.  */
+void f (struct FloatStruct* dst, float *src, unsigned int length)
+{
+    dst->f[0:length] = src[0:length];
+}