https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94366
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-11 branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:9119f51f40226526bfbb79dec07ef39ec8d87466 commit r11-8774-g9119f51f40226526bfbb79dec07ef39ec8d87466 Author: Jakub Jelinek <ja...@redhat.com> Date: Thu Jul 1 08:55:49 2021 +0200 openmp - Fix up && and || reductions [PR94366] As the testcase shows, the special treatment of && and || reduction combiners where we expand them as omp_out = (omp_out != 0) && (omp_in != 0) (or with ||) is not needed just for &&/|| on floating point or complex types, but for all &&/|| reductions - when expanded as omp_out = omp_out && omp_in (not in C but GENERIC) it is actually gimplified into NOP_EXPRs to bool from both operands, which turns non-zero values multiple of 2 into 0 rather than 1. This patch just treats all &&/|| the same and furthermore uses bool type instead of int for the comparisons. 2021-07-01 Jakub Jelinek <ja...@redhat.com> PR middle-end/94366 gcc/ * omp-low.c (lower_rec_input_clauses): Rename is_fp_and_or to is_truth_op, set it for TRUTH_*IF_EXPR regardless of new_var's type, use boolean_type_node instead of integer_type_node as NE_EXPR type. (lower_reduction_clauses): Likewise. libgomp/ * testsuite/libgomp.c-c++-common/pr94366.c: New test. (cherry picked from commit 91c771ec8a3b649765de3e0a7b04cf946c6649ef)