From cd4e76fcea6391ceb0136cffaea0672080f9eb17 Mon Sep 17 00:00:00 2001 From: Igor Zamyatin Date: Tue, 12 Aug 2014 12:27:41 +0000 Subject: [PATCH] re PR other/61962 (GCC seems to enter an infinite loop when compiling the above cilk+ code.) 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 | 6 ++++++ gcc/c-family/array-notation-common.c | 5 ++++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/c-c++-common/cilk-plus/AN/pr61962.c | 14 ++++++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/c-c++-common/cilk-plus/AN/pr61962.c diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index e71f6ed..269c6a1 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2014-08-12 Igor Zamyatin + + PR other/61962 + * array-notation-common.c (find_rank): Added handling for other + types of references. + 2014-08-10 Marek Polacek PR c/51849 diff --git a/gcc/c-family/array-notation-common.c b/gcc/c-family/array-notation-common.c index 84f6f45..f8bce04 100644 --- a/gcc/c-family/array-notation-common.c +++ b/gcc/c-family/array-notation-common.c @@ -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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 70d0653..260013b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-08-12 Igor Zamyatin + + PR other/61962 + * c-c++-common/cilk-plus/AN/pr61962.c: New test. + 2014-08-12 Thomas Preud'homme 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 index 0000000..08d4fe2 --- /dev/null +++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr61962.c @@ -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]; +} -- 2.7.4