public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/94120] New: [OpenACC] ICE in gimplify_adjust_omp_clauses_1 for 'declare' for variable outside scope
@ 2020-03-10 11:47 burnus at gcc dot gnu.org
  2020-03-10 12:11 ` [Bug middle-end/94120] " marxin at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-03-10 11:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94120
           Summary: [OpenACC] ICE in gimplify_adjust_omp_clauses_1 for
                    'declare' for variable outside scope
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, openacc
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

The following code gives an ICE; I believe it is invalid as:

"A declare directive must be in the same scope as the declaration of any var
that appears in the data clauses of the directive."


void
f_data (void)
{
  int B[10];
#pragma acc data
  {
# pragma acc declare copy(B)
    for (int i = 0; i < 10; i++)
      B[i] = -i;
  }
}

In gimplify_adjust_omp_clauses_1, flags = n->value == 1 (= GOVD_SEEN) and
gimplify_omp_ctxp->region_type == ORT_ACC_DATA. – As the value is seen but
nothing else matches, one runs into gcc_unreachable (in line 10123).

EXPECTED:
(a) no ICE :-)
(b) an error as the scope is different!

 * * *

Actually, I expect such an error for 'declare' in general (for C/C++/Fortran).

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

* [Bug middle-end/94120] [OpenACC] ICE in gimplify_adjust_omp_clauses_1 for 'declare' for variable outside scope
  2020-03-10 11:47 [Bug middle-end/94120] New: [OpenACC] ICE in gimplify_adjust_omp_clauses_1 for 'declare' for variable outside scope burnus at gcc dot gnu.org
@ 2020-03-10 12:11 ` marxin at gcc dot gnu.org
  2020-03-10 14:21 ` burnus at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-10 12:11 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-03-10
                 CC|                            |marxin at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Just for the record, started to ICE with r6-4824-g6e232ba4246ca324.

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

* [Bug middle-end/94120] [OpenACC] ICE in gimplify_adjust_omp_clauses_1 for 'declare' for variable outside scope
  2020-03-10 11:47 [Bug middle-end/94120] New: [OpenACC] ICE in gimplify_adjust_omp_clauses_1 for 'declare' for variable outside scope burnus at gcc dot gnu.org
  2020-03-10 12:11 ` [Bug middle-end/94120] " marxin at gcc dot gnu.org
@ 2020-03-10 14:21 ` burnus at gcc dot gnu.org
  2020-03-10 17:22 ` burnus at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-03-10 14:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Created attachment 48012
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48012&action=edit
Draft patch for C and Fortran, C++ is missing!

NOTE: A similar Fortran test case currently fails with:
  Error: Sorry, !$ACC DECLARE at (1) is not allowed in BLOCK construct

But the following is also invalid:

implicit none
integer :: i
contains
  subroutine f()
  !$acc declare copy(i)
  end
end

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

* [Bug middle-end/94120] [OpenACC] ICE in gimplify_adjust_omp_clauses_1 for 'declare' for variable outside scope
  2020-03-10 11:47 [Bug middle-end/94120] New: [OpenACC] ICE in gimplify_adjust_omp_clauses_1 for 'declare' for variable outside scope burnus at gcc dot gnu.org
  2020-03-10 12:11 ` [Bug middle-end/94120] " marxin at gcc dot gnu.org
  2020-03-10 14:21 ` burnus at gcc dot gnu.org
@ 2020-03-10 17:22 ` burnus at gcc dot gnu.org
  2020-03-11 13:31 ` burnus at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-03-10 17:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Patch for Fortran:
  https://gcc.gnu.org/pipermail/gcc-patches/current/541774.html

Todo: C (see attachment 48012) and C++ (patch) + testcases for both.

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

* [Bug middle-end/94120] [OpenACC] ICE in gimplify_adjust_omp_clauses_1 for 'declare' for variable outside scope
  2020-03-10 11:47 [Bug middle-end/94120] New: [OpenACC] ICE in gimplify_adjust_omp_clauses_1 for 'declare' for variable outside scope burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-03-10 17:22 ` burnus at gcc dot gnu.org
@ 2020-03-11 13:31 ` burnus at gcc dot gnu.org
  2020-03-12 10:47 ` burnus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-03-11 13:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #3)
> Patch for Fortran:
>   https://gcc.gnu.org/pipermail/gcc-patches/current/541774.html

Patch for C + C++:
https://gcc.gnu.org/pipermail/gcc-patches/current/541840.html

See also PR 94140 for declare and 'class' and OpenACC's Issue 288.

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

* [Bug middle-end/94120] [OpenACC] ICE in gimplify_adjust_omp_clauses_1 for 'declare' for variable outside scope
  2020-03-10 11:47 [Bug middle-end/94120] New: [OpenACC] ICE in gimplify_adjust_omp_clauses_1 for 'declare' for variable outside scope burnus at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-03-11 13:31 ` burnus at gcc dot gnu.org
@ 2020-03-12 10:47 ` burnus at gcc dot gnu.org
  2020-04-08  7:40 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-03-12 10:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #4)
> Patch for C + C++:
> https://gcc.gnu.org/pipermail/gcc-patches/current/541840.html
> See also PR 94140 for declare and 'class' and OpenACC's Issue 288.

The Fortran patch has been approved
  https://gcc.gnu.org/pipermail/gcc-patches/current/541907.html
and committed (to the master = GCC 10) as:
  https://gcc.gnu.org/g:98aeb1ef510204bf90e94b6cc85e5ba68df93d00

commit r10-7142-g98aeb1ef510204bf90e94b6cc85e5ba68df93d00
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Thu Mar 12 10:57:56 2020 +0100

    [Fortran, OpenACC] Reject vars of different scope in $acc declare (PR94120)

    2020-03-12  Tobias Burnus  <tobias@codesourcery.com>

            PR middle-end/94120
            * openmp.c (gfc_match_oacc_declare): Accept function-result
            variables; reject variables declared in a different scoping unit.

    2020-03-12  Tobias Burnus  <tobias@codesourcery.com>

            PR middle-end/94120
            * gfortran.dg/goacc/pr78260-2.f90: Correct scan-tree-dump-times.
            Extend test case to result variables.
            * gfortran.dg/goacc/declare-2.f95: Actually check
module-declaration
            restriction of OpenACC.
            * gfortran.dg/goacc/declare-3.f95: Remove case where this
            restriction is violated.
            * gfortran.dg/goacc/pr94120-1.f90: New.
            * gfortran.dg/goacc/pr94120-2.f90: New.
            * gfortran.dg/goacc/pr94120-3.f90: New.

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

* [Bug middle-end/94120] [OpenACC] ICE in gimplify_adjust_omp_clauses_1 for 'declare' for variable outside scope
  2020-03-10 11:47 [Bug middle-end/94120] New: [OpenACC] ICE in gimplify_adjust_omp_clauses_1 for 'declare' for variable outside scope burnus at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-03-12 10:47 ` burnus at gcc dot gnu.org
@ 2020-04-08  7:40 ` cvs-commit at gcc dot gnu.org
  2020-04-08  7:48 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-08  7:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>:

https://gcc.gnu.org/g:13e41d8b9d3d7598c72c38acc86a3d97046c8373

commit r10-7614-g13e41d8b9d3d7598c72c38acc86a3d97046c8373
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Wed Apr 8 09:39:43 2020 +0200

    [C/C++, OpenACC] Reject vars of different scope in acc declare (PR94120)

            gcc/c/
            PR middle-end/94120
            * c-decl.c (c_check_in_current_scope): New function.
            * c-tree.h (c_check_in_current_scope): Declare it.
            * c-parser.c (c_parser_oacc_declare): Add check that variables
            are declared in the same scope as the directive. Fix handling
            of namespace vars.

            gcc/cp/
            PR middle-end/94120
            * paser.c (cp_parser_oacc_declare): Add check that variables
            are declared in the same scope as the directive.

            gcc/testsuite/
            PR middle-end/94120
            * c-c++-common/goacc/declare-pr94120.c: New.
            * g++.dg/declare-pr94120.C: New.

            libgomp/testsuite/
            PR middle-end/94120
            * libgomp.oacc-c++/declare-pr94120.C: New.

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

* [Bug middle-end/94120] [OpenACC] ICE in gimplify_adjust_omp_clauses_1 for 'declare' for variable outside scope
  2020-03-10 11:47 [Bug middle-end/94120] New: [OpenACC] ICE in gimplify_adjust_omp_clauses_1 for 'declare' for variable outside scope burnus at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2020-04-08  7:40 ` cvs-commit at gcc dot gnu.org
@ 2020-04-08  7:48 ` burnus at gcc dot gnu.org
  2020-04-08 17:56 ` cvs-commit at gcc dot gnu.org
  2020-04-20 10:42 ` cvs-commit at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-04-08  7:48 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> ---
FIXED.

> See also PR 94140 for declare and 'class' and OpenACC's Issue 288.

[The namelist handling changed here, which depends on Issue 288; this will now
be also tracked at PR 94140.]

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

* [Bug middle-end/94120] [OpenACC] ICE in gimplify_adjust_omp_clauses_1 for 'declare' for variable outside scope
  2020-03-10 11:47 [Bug middle-end/94120] New: [OpenACC] ICE in gimplify_adjust_omp_clauses_1 for 'declare' for variable outside scope burnus at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2020-04-08  7:48 ` burnus at gcc dot gnu.org
@ 2020-04-08 17:56 ` cvs-commit at gcc dot gnu.org
  2020-04-20 10:42 ` cvs-commit at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-08 17:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 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:08d1e7a5aabcf7eeac48bfd99deb80451b8f9974

commit r10-7637-g08d1e7a5aabcf7eeac48bfd99deb80451b8f9974
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Apr 8 19:54:35 2020 +0200

    openacc: Fix up declare-pr94120.C testcase [PR94533]

    This test has been put in a wrong directory, where OpenACC tests aren't
    tested with -fopenacc, and also contained trailing semicolons.
    I've moved it where it belongs, added dg-error directives and removed
    the extra semicolons.

    2020-04-08  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/94120
            PR testsuite/94533
            * g++.dg/declare-pr94120.C: Move test to ...
            * g++.dg/goacc/declare-pr94120.C: ... here.  Add dg-error
directives.

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

* [Bug middle-end/94120] [OpenACC] ICE in gimplify_adjust_omp_clauses_1 for 'declare' for variable outside scope
  2020-03-10 11:47 [Bug middle-end/94120] New: [OpenACC] ICE in gimplify_adjust_omp_clauses_1 for 'declare' for variable outside scope burnus at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2020-04-08 17:56 ` cvs-commit at gcc dot gnu.org
@ 2020-04-20 10:42 ` cvs-commit at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-20 10:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>:

https://gcc.gnu.org/g:85d8c05a02bf7d1b256f806582a11e3fd8970a32

commit r10-7810-g85d8c05a02bf7d1b256f806582a11e3fd8970a32
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Mon Apr 20 12:38:50 2020 +0200

    Fix declare copyout in libgomp.oacc-c++/declare-pr94120.C

    Testing on the host does not make sense for 'declare copyout' for
    a same-scope stack-allocated variable. Once the copyout is done,
    the variable is gone. Hence, test the variable on the device. This
    can be revisit after the OpenACC semantic has been fixed; but with
    that fix, the test PASSes again with devices.

            PR middle-end/94120
            * testsuite/libgomp.oacc-c++/declare-pr94120.C: Fix 'declare
copy(out)'
            test case.

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

end of thread, other threads:[~2020-04-20 10:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-10 11:47 [Bug middle-end/94120] New: [OpenACC] ICE in gimplify_adjust_omp_clauses_1 for 'declare' for variable outside scope burnus at gcc dot gnu.org
2020-03-10 12:11 ` [Bug middle-end/94120] " marxin at gcc dot gnu.org
2020-03-10 14:21 ` burnus at gcc dot gnu.org
2020-03-10 17:22 ` burnus at gcc dot gnu.org
2020-03-11 13:31 ` burnus at gcc dot gnu.org
2020-03-12 10:47 ` burnus at gcc dot gnu.org
2020-04-08  7:40 ` cvs-commit at gcc dot gnu.org
2020-04-08  7:48 ` burnus at gcc dot gnu.org
2020-04-08 17:56 ` cvs-commit at gcc dot gnu.org
2020-04-20 10:42 ` cvs-commit 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).