OpenMP: Support complex/float in && and || reduction
authorTobias Burnus <tobias@codesourcery.com>
Tue, 4 May 2021 11:38:03 +0000 (13:38 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Tue, 4 May 2021 12:42:26 +0000 (14:42 +0200)
commit1580fc764423bf89e9b853aaa8c65999e37ccb8b
tree36f6858bdddd10b59525a1dca23df6bd03bb93d1
parent9174343256c06f7879f480c59203c1615601055c
OpenMP: Support complex/float in && and || reduction

C/C++ permit logical AND and logical OR also with floating-point or complex
arguments by doing an unequal zero comparison; the result is an 'int' with
value one or zero.  Hence, those are also permitted as reduction variable,
even though it is not the most sensible thing to do.

gcc/c/ChangeLog:

* c-typeck.c (c_finish_omp_clauses): Accept float + complex
for || and && reductions.

gcc/cp/ChangeLog:

* semantics.c (finish_omp_reduction_clause): Accept float + complex
for || and && reductions.

gcc/ChangeLog:

* omp-low.c (lower_rec_input_clauses, lower_reduction_clauses): Handle
&& and || with floating-point and complex arguments.

gcc/testsuite/ChangeLog:

* gcc.dg/gomp/clause-1.c: Use 'reduction(&:..)' instead of '...(&&:..)'.

libgomp/ChangeLog:

* testsuite/libgomp.c-c++-common/reduction-1.c: New test.
* testsuite/libgomp.c-c++-common/reduction-2.c: New test.
* testsuite/libgomp.c-c++-common/reduction-3.c: New test.
gcc/c/c-typeck.c
gcc/cp/semantics.c
gcc/omp-low.c
gcc/testsuite/gcc.dg/gomp/clause-1.c
libgomp/testsuite/libgomp.c-c++-common/reduction-1.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c-c++-common/reduction-2.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c-c++-common/reduction-3.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c-c++-common/reduction-4.c [new file with mode: 0644]