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/98088] [9/10/11 Regression] ICE in expand_oacc_collapse_init, at omp-expand.c:1533
Date: Sun, 11 Apr 2021 13:54:09 +0000	[thread overview]
Message-ID: <bug-98088-4-gmMNqGEo9N@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-98088-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Hafiz Abid Qadeer <abidh@gcc.gnu.org>:

https://gcc.gnu.org/g:ac200799acb5cd2fb9e1758f6bf5fff1978daaeb

commit r11-8123-gac200799acb5cd2fb9e1758f6bf5fff1978daaeb
Author: Hafiz Abid Qadeer <abidh@codesourcery.com>
Date:   Thu Apr 8 17:31:30 2021 +0100

    [OpenACC] Fix an ICE where a loop with GT condition is collapsed.

    We have seen an ICE both on trunk and devel/omp/gcc-10 branches which can
    be reprodued with this simple testcase.  It occurs if an OpenACC loop has
    a collapse clause and any of the loop being collapsed uses GT or GE
    condition.  This issue is specific to OpenACC.

    int main (void)
    {
      int ix, iy;
      int dim_x = 16, dim_y = 16;
      {
           for (iy = dim_y - 1; iy > 0; --iy)
           for (ix = dim_x - 1; ix > 0; --ix)
            ;
      }
    }

    The problem is caused by a failing assertion in expand_oacc_collapse_init.
    It checks that cond_code for fd->loop should be same as cond_code for all
    the loops that are being collapsed.  As the cond_code for fd->loop is
    LT_EXPR with collapse clause (set at the end of omp_extract_for_data),
    this assertion forces that all the loop in collapse clause should use
    < operator.

    There does not seem to be anything in the code which demands this
    condition as loop with > condition works ok otherwise.  I digged old
    mailing list a bit but could not find any discussion on this change.
    Looking at the code, expand_oacc_for checks that fd->loop->cond_code is
    either LT_EXPR or GT_EXPR.  I guess the original intention was to have
    similar checks on the loop which are being collapsed. But the way check
    was written does not acheive that.

    I have fixed it by modifying the check in the assertion to be same as
    check on fd->loop->cond_code.

    I tested goacc and libgomp (with nvptx offloading) and did not see any
    regression.  I have added new tests to check collapse with GT/GE condition.

            PR middle-end/98088
            gcc/
            * omp-expand.c (expand_oacc_collapse_init): Update condition in
            a gcc_assert.

            gcc/testsuite/
            * c-c++-common/goacc/collapse-2.c: New.

            libgomp/
            * testsuite/libgomp.oacc-c-c++-common/collapse-2.c: Add check
            for loop with GT/GE condition.
            * testsuite/libgomp.oacc-c-c++-common/collapse-3.c: Likewise.

  parent reply	other threads:[~2021-04-11 13:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01 17:57 [Bug c/98088] New: " gscfq@t-online.de
2020-12-02  8:21 ` [Bug middle-end/98088] " rguenth at gcc dot gnu.org
2021-01-14 10:58 ` rguenth at gcc dot gnu.org
2021-01-29 14:04 ` jakub at gcc dot gnu.org
2021-01-29 14:11 ` jakub at gcc dot gnu.org
2021-02-01 12:57 ` jakub at gcc dot gnu.org
2021-04-11 13:54 ` cvs-commit at gcc dot gnu.org [this message]
2021-04-11 13:56 ` abidh at gcc dot gnu.org
2021-04-18 11:56 ` cvs-commit 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-98088-4-gmMNqGEo9N@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).