public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/100669] New: [OpenACC] ICE with array-reduction variable & related issues
Date: Wed, 19 May 2021 08:32:35 +0000	[thread overview]
Message-ID: <bug-100669-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 100669
           Summary: [OpenACC] ICE with array-reduction variable & related
                    issues
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code, openacc
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: tschwinge at gcc dot gnu.org
  Target Milestone: ---

While OpenMP supports  reduction(+: sum[:10]) [→ PR99928 comment 8],
it is not quite clear to me whether OpenACC supports it.
(Admittedly, I also have not verified it in the OpenACC spec, yet).

I did not find any OpenACC testcase related to array reduction or struct
element/derived-type component reductions.


In any case, in C/C++, using an array gives the following ICE:

# gcc-trunk -fopenacc -fdump-tree-original foo.c

foo.c: In function ‘foo’:
foo.c:6:11: internal compiler error: tree check: expected tree that contains
‘decl minimal’ structure, have ‘mem_ref’ in splay_tree_compare_decl_uid, at
gimplify.c:440
    6 |   #pragma acc parallel loop reduction(+:sum)
      |           ^~~

0x788f2f tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
        ../../repos/gcc/gcc/tree.c:8857


 * * *

On the Fortran side,  reduction(+: array) is permitted for OpenACC during
parsing
but fails during resolution time with:

  Error: Array ‘sum’ is not permitted in reduction at (1)

I also note that for a derived type, there is the odd result:

   46 |   !$acc parallel loop reduction(+:x%sum3)
      |                                  1
  Error: !$OMP DECLARE REDUCTION + not found for type TYPE(t) at (1)

with 'type t; integer :: sum3; end type'.

Namely: the error is a bit odd as the reduction variable is 'integer' which
does not need declare reduction – while the error talks about the derived type
itself ('x')

Question: Is it expected that 'x%...' should be parsed (accepted) with OpenACC?
With OpenMP it fails at parse time with:

   38 |   !$omp parallel do reduction(+:x%sum3)
      |                                  1
   Error: Syntax error in OpenMP variable list at (1)


NOTE: I have not checked what happens on the C/C++ side with struct elements.

             reply	other threads:[~2021-05-19  8:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-19  8:32 burnus at gcc dot gnu.org [this message]
2021-05-19  9:38 ` [Bug middle-end/100669] " tschwinge 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-100669-4@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).