public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/95109] New: [11 regression] ICE in gfortran.dg/gomp/target1.f90 after r11-349
@ 2020-05-13 16:54 seurer at linux dot vnet.ibm.com
  2020-05-13 17:08 ` [Bug fortran/95109] " burnus at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: seurer at linux dot vnet.ibm.com @ 2020-05-13 16:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95109
           Summary: [11 regression] ICE in gfortran.dg/gomp/target1.f90
                    after r11-349
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: seurer at linux dot vnet.ibm.com
  Target Milestone: ---

git g:f884bef21cccc05d748fd7869cd641cbb4f6b6bb, r11-349
make -k check-gcc RUNTESTFLAGS=gomp.exp=gfortran.dg/gomp/target1.f90

# of unexpected failures        2

FAIL: gfortran.dg/gomp/target1.f90   -O  (internal compiler error)
FAIL: gfortran.dg/gomp/target1.f90   -O  (test for excess errors)

FAIL: gfortran.dg/gomp/target1.f90   -O  (test for excess errors)
Excess errors:
during GIMPLE pass: omplower
/home/seurer/gcc/git/gcc-test2/gcc/testsuite/gfortran.dg/gomp/target1.f90:318:0:
internal compiler error: in lookup_decl_in_outer_ctx, at omp-low.c:3967
0x10a156cb lookup_decl_in_outer_ctx
        /home/seurer/gcc/git/gcc-test2/gcc/omp-low.c:3967
0x10a44a7b lower_send_clauses
        /home/seurer/gcc/git/gcc-test2/gcc/omp-low.c:7290
0x10a44a7b lower_omp_taskreg
        /home/seurer/gcc/git/gcc-test2/gcc/omp-low.c:11295
0x10a2adc7 lower_omp_1
        /home/seurer/gcc/git/gcc-test2/gcc/omp-low.c:12878
0x10a2adc7 lower_omp
        /home/seurer/gcc/git/gcc-test2/gcc/omp-low.c:13015
0x10a2a18b lower_omp_1
        /home/seurer/gcc/git/gcc-test2/gcc/omp-low.c:12807
0x10a2a18b lower_omp
        /home/seurer/gcc/git/gcc-test2/gcc/omp-low.c:13015
0x10a467bb lower_omp_for
        /home/seurer/gcc/git/gcc-test2/gcc/omp-low.c:10564
0x10a2b147 lower_omp_1
        /home/seurer/gcc/git/gcc-test2/gcc/omp-low.c:12823
0x10a2b147 lower_omp
        /home/seurer/gcc/git/gcc-test2/gcc/omp-low.c:13015
0x10a2a18b lower_omp_1
        /home/seurer/gcc/git/gcc-test2/gcc/omp-low.c:12807
0x10a2a18b lower_omp
        /home/seurer/gcc/git/gcc-test2/gcc/omp-low.c:13015
0x10a2a18b lower_omp_1
        /home/seurer/gcc/git/gcc-test2/gcc/omp-low.c:12807
0x10a2a18b lower_omp
        /home/seurer/gcc/git/gcc-test2/gcc/omp-low.c:13015
0x10a2a18b lower_omp_1
        /home/seurer/gcc/git/gcc-test2/gcc/omp-low.c:12807
0x10a2a18b lower_omp
        /home/seurer/gcc/git/gcc-test2/gcc/omp-low.c:13015
0x10a2a18b lower_omp_1
        /home/seurer/gcc/git/gcc-test2/gcc/omp-low.c:12807
0x10a2a18b lower_omp
        /home/seurer/gcc/git/gcc-test2/gcc/omp-low.c:13015
0x10a2a18b lower_omp_1
        /home/seurer/gcc/git/gcc-test2/gcc/omp-low.c:12807
0x10a2a18b lower_omp
        /home/seurer/gcc/git/gcc-test2/gcc/omp-low.c:13015

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

* [Bug fortran/95109] [11 regression] ICE in gfortran.dg/gomp/target1.f90 after r11-349
  2020-05-13 16:54 [Bug fortran/95109] New: [11 regression] ICE in gfortran.dg/gomp/target1.f90 after r11-349 seurer at linux dot vnet.ibm.com
@ 2020-05-13 17:08 ` burnus at gcc dot gnu.org
  2020-05-14  6:16 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-05-13 17:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Confirmed – see PR 94690 comment 10.

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

* [Bug fortran/95109] [11 regression] ICE in gfortran.dg/gomp/target1.f90 after r11-349
  2020-05-13 16:54 [Bug fortran/95109] New: [11 regression] ICE in gfortran.dg/gomp/target1.f90 after r11-349 seurer at linux dot vnet.ibm.com
  2020-05-13 17:08 ` [Bug fortran/95109] " burnus at gcc dot gnu.org
@ 2020-05-14  6:16 ` rguenth at gcc dot gnu.org
  2020-05-19 18:44 ` msebor at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-05-14  6:16 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.0

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

* [Bug fortran/95109] [11 regression] ICE in gfortran.dg/gomp/target1.f90 after r11-349
  2020-05-13 16:54 [Bug fortran/95109] New: [11 regression] ICE in gfortran.dg/gomp/target1.f90 after r11-349 seurer at linux dot vnet.ibm.com
  2020-05-13 17:08 ` [Bug fortran/95109] " burnus at gcc dot gnu.org
  2020-05-14  6:16 ` rguenth at gcc dot gnu.org
@ 2020-05-19 18:44 ` msebor at gcc dot gnu.org
  2020-06-10  9:12 ` marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-05-19 18:44 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
               Host|powerpc64*-linux-gnu        |powerpc64*-linux-gnu
                   |                            |x86_64-linux
   Last reconfirmed|                            |2020-05-19
                 CC|                            |msebor at gcc dot gnu.org

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed.  Also reported on x86_64-linux here:
https://gcc.gnu.org/pipermail/gcc-testresults/2020-May/561528.html

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

* [Bug fortran/95109] [11 regression] ICE in gfortran.dg/gomp/target1.f90 after r11-349
  2020-05-13 16:54 [Bug fortran/95109] New: [11 regression] ICE in gfortran.dg/gomp/target1.f90 after r11-349 seurer at linux dot vnet.ibm.com
                   ` (2 preceding siblings ...)
  2020-05-19 18:44 ` msebor at gcc dot gnu.org
@ 2020-06-10  9:12 ` marxin at gcc dot gnu.org
  2020-06-12  8:21 ` burnus at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-06-10  9:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Any update on the failing target1.f90 test-case?

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

* [Bug fortran/95109] [11 regression] ICE in gfortran.dg/gomp/target1.f90 after r11-349
  2020-05-13 16:54 [Bug fortran/95109] New: [11 regression] ICE in gfortran.dg/gomp/target1.f90 after r11-349 seurer at linux dot vnet.ibm.com
                   ` (3 preceding siblings ...)
  2020-06-10  9:12 ` marxin at gcc dot gnu.org
@ 2020-06-12  8:21 ` burnus at gcc dot gnu.org
  2020-07-01 18:02 ` dominiq at lps dot ens.fr
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-06-12  8:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #3)
> Any update on the failing target1.f90 test-case?

Not yet. What needs to be done is to mark loop variables as "private" – and
attach this to the proper OpenMP directive; with "teams", "distribute" and
multiple loops this can get rather complex.

The middle end does this for "for" loops – but the Fortran FE *only* generates
them for OpenMP loops – in particular for "simd". For normal Fortran loops, the
ME does not recognize the loop variable.

Hence, the complex algorithm of "2.19.1.1 Variables Referenced in a Construct"
has to be implemented – i.e. skipping the private for those which already have
firstprivate/lastprivate/private and attaching it to the correct directive.

The ICE occurs if the private is attached to the wrong OpenMP directive which
the ME then confuses.

There can be a large number of directives combined (see target1.f90):
  !$omp target teams distribute parallel do …
      do i = 1, 10
        do j = 1, 10
with some clauses like collapse(1) or collapse(2) or …

The FE adds the "private" in gfc_resolve_do_iterator – and later in
gfc_trans_omp_do (only for the OpenMP loops, there can be "normal" loops in
between) and for combined directives above, they get split in
gfc_split_omp_clauses – hence, the predetermined …private has end up on the
right directive.

I think adding 'private' only for non-OpenMP will avoid some split issues – but
to do this, one has to evaluate 'collapse' etc. to know whether a loop becomes
a ME-treated 'for' loop or not.

And for nested omp directives, one has to attach the directive to the right
directive.

Example:

!$omp teams
!$omp distribute
!$omp do
do i = 1,n  ! Omp loop, handled by ME
  do j = 1, m ! Fortran loop, unless collapse(2) 
…
do i = 1,n … ! Fortran loop – not 'omp do' but inside 'omp distribute'

To which directive should "private(i)" and private(j) be attached to? How
differs this if there is a private/lastprivate/firstprivate on any of the
directives?

(The patch which causes this fail fixed other ICEs with another test case, but
caused the target1.f90 fail. Thus, by undoing/doing those bits of r11-349 one
can toggle between ICEs in the same ME function.)

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

* [Bug fortran/95109] [11 regression] ICE in gfortran.dg/gomp/target1.f90 after r11-349
  2020-05-13 16:54 [Bug fortran/95109] New: [11 regression] ICE in gfortran.dg/gomp/target1.f90 after r11-349 seurer at linux dot vnet.ibm.com
                   ` (4 preceding siblings ...)
  2020-06-12  8:21 ` burnus at gcc dot gnu.org
@ 2020-07-01 18:02 ` dominiq at lps dot ens.fr
  2020-07-02  5:59 ` gscfq@t-online.de
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-07-01 18:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Reduced testcase:

! { dg-do compile }

module target1
contains
  subroutine foo (n, o, p, q, r, pp)
    integer :: n, o, p, q, r, s, i, j
    integer :: a (2:o)
    integer, pointer :: pp
  !$omp target data device (n + 1) if (n .ne. 6) map (tofrom: n, r)
    !$omp target teams device (n + 1) if (n .ne. 6)map (from: n) &
    !$omp & map (alloc: a(2:o)) num_teams (n + 4) thread_limit (n * 2) &
    !$omp & default(shared) shared(n) private (p) reduction(+:r)
    !$omp distribute parallel do simd if(n.ne.6)default(shared)&
    !$omp & private (p) firstprivate (q) shared (n) reduction (+: r) &
    !$omp & dist_schedule (static, 4) collapse (2) safelen(8) &
    !$omp & num_threads (n + 4) proc_bind (spread) lastprivate (s) &
    !$omp & schedule (static, 8)
      do i = 1, 10
        do j = 1, 10
          r = r + 1
          p = q
          a(2+i*10+j) = p + q
          s = i * 10 + j
        end do
      end do
    !$omp end target teams
  !$omp end target data
  end subroutine
end module

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

* [Bug fortran/95109] [11 regression] ICE in gfortran.dg/gomp/target1.f90 after r11-349
  2020-05-13 16:54 [Bug fortran/95109] New: [11 regression] ICE in gfortran.dg/gomp/target1.f90 after r11-349 seurer at linux dot vnet.ibm.com
                   ` (5 preceding siblings ...)
  2020-07-01 18:02 ` dominiq at lps dot ens.fr
@ 2020-07-02  5:59 ` gscfq@t-online.de
  2020-09-09  7:34 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: gscfq@t-online.de @ 2020-07-02  5:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from G. Steinmetz <gscfq@t-online.de> ---

And reducing especially the directives :

$ cat z1.f90
program p
   !$omp target data map(tofrom:n,r)
   !$omp target teams reduction(+:r)
   !$omp distribute parallel do simd collapse(2)
   do i = 1, 10
      do j = 1, 10
      end do
   end do
   !$omp end target teams
   !$omp end target data
end

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

* [Bug fortran/95109] [11 regression] ICE in gfortran.dg/gomp/target1.f90 after r11-349
  2020-05-13 16:54 [Bug fortran/95109] New: [11 regression] ICE in gfortran.dg/gomp/target1.f90 after r11-349 seurer at linux dot vnet.ibm.com
                   ` (6 preceding siblings ...)
  2020-07-02  5:59 ` gscfq@t-online.de
@ 2020-09-09  7:34 ` cvs-commit at gcc dot gnu.org
  2020-09-09  9:55 ` cvs-commit at gcc dot gnu.org
  2020-09-09 11:27 ` burnus at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-09  7:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 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:61c2d476a52bb108bd05d0226c5522bf0c4b24b5

commit r11-3066-g61c2d476a52bb108bd05d0226c5522bf0c4b24b5
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Wed Sep 9 09:33:51 2020 +0200

    Fortran: Fixes for OpenMP loop-iter privatization (PRs 95109 + 94690)

    This commit also fixes a gfortran.dg/gomp/target1.f90 regression;
    target1.f90 tests the resolve.c and openmp.c changes.

    gcc/fortran/ChangeLog:

            PR fortran/95109
            PR fortran/94690
            * resolve.c (gfc_resolve_code): Also call
            gfc_resolve_omp_parallel_blocks for 'distribute parallel do
(simd)'.
            * openmp.c (gfc_resolve_omp_parallel_blocks): Handle it.
            (gfc_resolve_do_iterator): Remove special code for SIMD, which is
            not needed.
            * trans-openmp.c (gfc_trans_omp_target): For
TARGET_PARALLEL_DO_SIMD,
            call simd not do processing function.

    gcc/testsuite/ChangeLog:

            PR fortran/95109
            PR fortran/94690
            * gfortran.dg/gomp/combined-if.f90: Update scan-tree-dump-times for
            'omp simd.*if'.
            * gfortran.dg/gomp/openmp-simd-5.f90: New test.

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

* [Bug fortran/95109] [11 regression] ICE in gfortran.dg/gomp/target1.f90 after r11-349
  2020-05-13 16:54 [Bug fortran/95109] New: [11 regression] ICE in gfortran.dg/gomp/target1.f90 after r11-349 seurer at linux dot vnet.ibm.com
                   ` (7 preceding siblings ...)
  2020-09-09  7:34 ` cvs-commit at gcc dot gnu.org
@ 2020-09-09  9:55 ` cvs-commit at gcc dot gnu.org
  2020-09-09 11:27 ` burnus at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-09  9:55 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

commit r10-8721-gf93eba8c5fde83100bf0854607848b6f50c8bbb2
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Wed Sep 9 11:54:43 2020 +0200

    Fortran: Fixes for OpenMP loop-iter privatization (PRs 95109 + 94690)

    This commit also fixes a gfortran.dg/gomp/target1.f90 regression;
    target1.f90 tests the resolve.c and openmp.c changes.

    gcc/fortran/ChangeLog:

            PR fortran/95109
            PR fortran/94690
            * resolve.c (gfc_resolve_code): Also call
            gfc_resolve_omp_parallel_blocks for 'distribute parallel do
(simd)'.
            * openmp.c (gfc_resolve_omp_parallel_blocks): Handle it.
            * trans-openmp.c (gfc_trans_omp_target): For
TARGET_PARALLEL_DO_SIMD,
            call simd not do processing function.

    gcc/testsuite/ChangeLog:

            PR fortran/95109
            PR fortran/94690
            * gfortran.dg/gomp/openmp-simd-5.f90: New test.

    (cherry picked from commit 61c2d476a52bb108bd05d0226c5522bf0c4b24b5)

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

* [Bug fortran/95109] [11 regression] ICE in gfortran.dg/gomp/target1.f90 after r11-349
  2020-05-13 16:54 [Bug fortran/95109] New: [11 regression] ICE in gfortran.dg/gomp/target1.f90 after r11-349 seurer at linux dot vnet.ibm.com
                   ` (8 preceding siblings ...)
  2020-09-09  9:55 ` cvs-commit at gcc dot gnu.org
@ 2020-09-09 11:27 ` burnus at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-09-09 11:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #9 from Tobias Burnus <burnus at gcc dot gnu.org> ---
FIXED on mainline (GCC 11), backported to GCC 10 and to OG10 =
devel/omp/gcc-10.

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

end of thread, other threads:[~2020-09-09 11:27 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-13 16:54 [Bug fortran/95109] New: [11 regression] ICE in gfortran.dg/gomp/target1.f90 after r11-349 seurer at linux dot vnet.ibm.com
2020-05-13 17:08 ` [Bug fortran/95109] " burnus at gcc dot gnu.org
2020-05-14  6:16 ` rguenth at gcc dot gnu.org
2020-05-19 18:44 ` msebor at gcc dot gnu.org
2020-06-10  9:12 ` marxin at gcc dot gnu.org
2020-06-12  8:21 ` burnus at gcc dot gnu.org
2020-07-01 18:02 ` dominiq at lps dot ens.fr
2020-07-02  5:59 ` gscfq@t-online.de
2020-09-09  7:34 ` cvs-commit at gcc dot gnu.org
2020-09-09  9:55 ` cvs-commit at gcc dot gnu.org
2020-09-09 11:27 ` burnus 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).