[Bug c++/69363] ICE when doing a pragma simd reduction with max

2016-05-09 Thread cesar at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69363

--- Comment #8 from cesar at gcc dot gnu.org ---
Author: cesar
Date: Mon May  9 20:23:31 2016
New Revision: 236047

URL: https://gcc.gnu.org/viewcvs?rev=236047&root=gcc&view=rev
Log:
Backport trunk r235290:
2016-04-20  Ilya Verbin  

gcc/c-family/
PR c++/69363
* c-cilkplus.c (c_finish_cilk_clauses): Remove function.
* c-common.h (c_finish_cilk_clauses): Remove declaration.

gcc/c/
PR c++/69363
* c-parser.c (c_parser_cilk_all_clauses): Use c_finish_omp_clauses
instead of c_finish_cilk_clauses.
* c-tree.h (c_finish_omp_clauses): Add new default argument.
* c-typeck.c (c_finish_omp_clauses): Add new argument.  Allow
floating-point variables in the linear clause for Cilk Plus.

gcc/cp/
PR c++/69363
* cp-tree.h (finish_omp_clauses): Add new default argument.
* parser.c (cp_parser_cilk_simd_all_clauses): Use finish_omp_clauses
instead of c_finish_cilk_clauses.
* semantics.c (finish_omp_clauses): Add new argument.  Allow
floating-point variables in the linear clause for Cilk Plus.

gcc/testsuite/
PR c++/69363
* c-c++-common/cilk-plus/PS/clauses3.c: Adjust dg-error string.
* c-c++-common/cilk-plus/PS/clauses4.c: New test.
* c-c++-common/cilk-plus/PS/pr69363.c: New test.


Added:
branches/gomp-4_0-branch/gcc/testsuite/c-c++-common/cilk-plus/PS/clauses4.c
branches/gomp-4_0-branch/gcc/testsuite/c-c++-common/cilk-plus/PS/pr69363.c
Modified:
branches/gomp-4_0-branch/gcc/c-family/ChangeLog.gomp
branches/gomp-4_0-branch/gcc/c-family/c-cilkplus.c
branches/gomp-4_0-branch/gcc/c-family/c-common.h
branches/gomp-4_0-branch/gcc/c/ChangeLog.gomp
branches/gomp-4_0-branch/gcc/c/c-parser.c
branches/gomp-4_0-branch/gcc/c/c-tree.h
branches/gomp-4_0-branch/gcc/c/c-typeck.c
branches/gomp-4_0-branch/gcc/cp/ChangeLog.gomp
branches/gomp-4_0-branch/gcc/cp/cp-tree.h
branches/gomp-4_0-branch/gcc/cp/parser.c
branches/gomp-4_0-branch/gcc/cp/semantics.c
branches/gomp-4_0-branch/gcc/testsuite/ChangeLog.gomp
branches/gomp-4_0-branch/gcc/testsuite/c-c++-common/cilk-plus/PS/clauses3.c

[Bug c++/69363] ICE when doing a pragma simd reduction with max

2016-04-20 Thread iverbin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69363

iverbin at gcc dot gnu.org changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from iverbin at gcc dot gnu.org ---
Fixed in GCC 7.

[Bug c++/69363] ICE when doing a pragma simd reduction with max

2016-04-20 Thread iverbin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69363

--- Comment #6 from iverbin at gcc dot gnu.org ---
Author: iverbin
Date: Wed Apr 20 15:48:53 2016
New Revision: 235290

URL: https://gcc.gnu.org/viewcvs?rev=235290&root=gcc&view=rev
Log:
Fix PR c++/69363

gcc/c-family/
PR c++/69363
* c-cilkplus.c (c_finish_cilk_clauses): Remove function.
* c-common.h (c_finish_cilk_clauses): Remove declaration.
gcc/c/
PR c++/69363
* c-parser.c (c_parser_cilk_all_clauses): Use c_finish_omp_clauses
instead of c_finish_cilk_clauses.
* c-tree.h (c_finish_omp_clauses): Add new default argument.
* c-typeck.c (c_finish_omp_clauses): Add new argument.  Allow
floating-point variables in the linear clause for Cilk Plus.
gcc/cp/
PR c++/69363
* cp-tree.h (finish_omp_clauses): Add new default argument.
* parser.c (cp_parser_cilk_simd_all_clauses): Use finish_omp_clauses
instead of c_finish_cilk_clauses.
* semantics.c (finish_omp_clauses): Add new argument.  Allow
floating-point variables in the linear clause for Cilk Plus.
gcc/testsuite/
PR c++/69363
* c-c++-common/cilk-plus/PS/clauses3.c: Adjust dg-error string.
* c-c++-common/cilk-plus/PS/clauses4.c: New test.
* c-c++-common/cilk-plus/PS/pr69363.c: New test.

Added:
trunk/gcc/testsuite/c-c++-common/cilk-plus/PS/clauses4.c
trunk/gcc/testsuite/c-c++-common/cilk-plus/PS/pr69363.c
Modified:
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c-cilkplus.c
trunk/gcc/c-family/c-common.h
trunk/gcc/c/ChangeLog
trunk/gcc/c/c-parser.c
trunk/gcc/c/c-tree.h
trunk/gcc/c/c-typeck.c
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/cp-tree.h
trunk/gcc/cp/parser.c
trunk/gcc/cp/semantics.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/c-c++-common/cilk-plus/PS/clauses3.c

[Bug c++/69363] ICE when doing a pragma simd reduction with max

2016-02-17 Thread iverbin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69363

iverbin at gcc dot gnu.org changed:

   What|Removed |Added

 Status|ASSIGNED|WAITING

--- Comment #5 from iverbin at gcc dot gnu.org ---
Waiting for stage1: https://gcc.gnu.org/ml/gcc-patches/2016-02/msg01183.html

[Bug c++/69363] ICE when doing a pragma simd reduction with max

2016-02-16 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69363

--- Comment #4 from Jakub Jelinek  ---
IMHO for consistency you should change the C FE too.

[Bug c++/69363] ICE when doing a pragma simd reduction with max

2016-02-16 Thread iverbin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69363

iverbin at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

--- Comment #3 from iverbin at gcc dot gnu.org ---
It turns out that there is at least one difference between Cilk Plus and OpenMP
finalization - Cilk Plus allows float and double variables in linear clause,
while OpenMP doesn't.  I'm going to adjust finish_omp_clauses accordingly.

[Bug c++/69363] ICE when doing a pragma simd reduction with max

2016-02-15 Thread iverbin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69363

iverbin at gcc dot gnu.org changed:

   What|Removed |Added

 CC||iverbin at gcc dot gnu.org

--- Comment #2 from iverbin at gcc dot gnu.org ---
(In reply to Jakub Jelinek from comment #1)
> The bug is that cp_parser_cilk_simd_all_clauses and
> c_parser_cilk_simd_all_clauses calls c_finish_cilk_clauses rather than the
> OpenMP clauses finalization routines in each of the FEs, perhaps with some
> argument that would say it wants Cilk+ semantics instead of OpenMP.
> That way, it misses lots of important actions that need to be performed on
> the clauses.

Yep, this patch fixes original testcase and 23 fails in Cilk Plus Conformance
Suite v1.2.1  without new regressions.

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 6f47edf..9e12a96 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -37621,7 +37621,7 @@ cp_parser_cilk_simd_all_clauses (cp_parser *parser,
cp_token *pragma_token)
   if (clauses == error_mark_node)
 return error_mark_node;
   else
-return c_finish_cilk_clauses (clauses);
+return finish_omp_clauses (clauses, false);
 }

 /* Main entry-point for parsing Cilk Plus <#pragma simd> for loops.  */

[Bug c++/69363] ICE when doing a pragma simd reduction with max

2016-01-20 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69363

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-01-20
 CC||jakub at gcc dot gnu.org,
   ||kyukhin at gcc dot gnu.org
 Ever confirmed|0   |1

[Bug c++/69363] ICE when doing a pragma simd reduction with max

2016-01-20 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69363

--- Comment #1 from Jakub Jelinek  ---
The bug is that cp_parser_cilk_simd_all_clauses and
c_parser_cilk_simd_all_clauses calls c_finish_cilk_clauses rather than the
OpenMP clauses finalization routines in each of the FEs, perhaps with some
argument that would say it wants Cilk+ semantics instead of OpenMP.
That way, it misses lots of important actions that need to be performed on the
clauses.
E.g. for reduction performs in C++ finish_omp_reduction_clause, which looks up
the reduction, handles the placeholder, handles array reductions (not sure if
Cilk+ means to support them, if not, it should reject them during parsing), but
many other things (e.g. arrange for the ctors/copy ctors/assignment op/dtors to
be made available for the omp lowering purposes on privatization clauses where
needed, diagnosing invalid clause combinations (c_finish_cilk_clauses seems to
only reject the same var being in linear and some other clause, but the
gimplifier/middle-end will be certainly upset about many other duplications,
like
the same var both private and firstprivate, etc.).
So, I'd strongly recommend to just use the OpenMP clause finalization and if
you really need to tweak anything in there for Cilk+ compared to OpenMP rules,
test some cilk flag on those and add sufficient testsuite coverage for that.

As expected, with -fopenmp
#include 

double t1(double* x, int N) {
  double result = 0;
  int i;
#pragma omp simd reduction(max:result) private(i)
  for(int i=0; i