public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/94366] OpenMP Parallel Reduction with "&&" operator does not compute correct result
Date: Thu, 01 Jul 2021 07:00:18 +0000	[thread overview]
Message-ID: <bug-94366-4-G9rO4xWoCO@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94366-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94366

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:91c771ec8a3b649765de3e0a7b04cf946c6649ef

commit r12-1947-g91c771ec8a3b649765de3e0a7b04cf946c6649ef
Author: Jakub Jelinek <jakub@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  <jakub@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.

  parent reply	other threads:[~2021-07-01  7:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-27 18:27 [Bug c/94366] New: " satzeni at nvidia dot com
2021-06-30  7:55 ` [Bug c/94366] " pal0009 at uah dot edu
2021-06-30 10:33 ` [Bug middle-end/94366] " jakub at gcc dot gnu.org
2021-07-01  7:00 ` cvs-commit at gcc dot gnu.org [this message]
2021-07-01  7:54 ` jakub at gcc dot gnu.org
2021-07-18 23:29 ` cvs-commit at gcc dot gnu.org
2022-05-10  8:19 ` cvs-commit at gcc dot gnu.org
2022-05-11  6:21 ` cvs-commit at gcc dot gnu.org
2022-05-11  6:33 ` jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-94366-4-G9rO4xWoCO@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).