From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 359783857C48; Wed, 19 May 2021 08:32:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 359783857C48 From: "burnus at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: ice-on-valid-code, openacc X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 08:32:36 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100669 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]) [=E2=86=92 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 =E2=80=98foo=E2=80=99: foo.c:6:11: internal compiler error: tree check: expected tree that contains =E2=80=98decl minimal=E2=80=99 structure, have =E2=80=98mem_ref=E2=80=99 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 =E2=80=98sum=E2=80=99 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 =E2=80=93 while the error talks about the d= erived type itself ('x') Question: Is it expected that 'x%...' should be parsed (accepted) with Open= ACC? 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 element= s.=