public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/100669] New: [OpenACC] ICE with array-reduction variable & related issues
@ 2021-05-19  8:32 burnus at gcc dot gnu.org
  2021-05-19  9:38 ` [Bug middle-end/100669] " tschwinge at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-05-19  8:32 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug middle-end/100669] [OpenACC] ICE with array-reduction variable & related issues
  2021-05-19  8:32 [Bug middle-end/100669] New: [OpenACC] ICE with array-reduction variable & related issues burnus at gcc dot gnu.org
@ 2021-05-19  9:38 ` tschwinge at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2021-05-19  9:38 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Schwinge <tschwinge at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-05-19
           Keywords|ice-on-valid-code           |ice-on-invalid-code
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
We're currently implementing OpenACC 2.6, and only in OpenACC 2.7 we have: 1.12
"Changes from Version 2.6 to 2.7": "Arrays, subarrays and composite variables
are now allowed in 'reduction' clauses; [...]".  (Thus 'ice-on-valid-code' ->
'ice-on-invalid-code'.)


That said, of course we shouldn't run into an ICE.  I wonder if that's a
regression, or has been like that "forever"?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-19  9:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-19  8:32 [Bug middle-end/100669] New: [OpenACC] ICE with array-reduction variable & related issues burnus at gcc dot gnu.org
2021-05-19  9:38 ` [Bug middle-end/100669] " tschwinge at gcc dot gnu.org

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).