Bug 92756 - [9 Regression] ICE in lower_omp, at omp-low.c:12988
Summary: [9 Regression] ICE in lower_omp, at omp-low.c:12988
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 10.0
: P3 normal
Target Milestone: 9.3
Assignee: Jakub Jelinek
URL:
Keywords: openmp
Depends on:
Blocks:
 
Reported: 2019-12-02 18:50 UTC by G. Steinmetz
Modified: 2019-12-20 18:30 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 8.3.0
Known to fail: 10.0, 9.2.0
Last reconfirmed: 2019-12-03 00:00:00


Attachments
gcc10-pr92756.patch (1.51 KB, patch)
2019-12-03 19:12 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description G. Steinmetz 2019-12-02 18:50:06 UTC
Changed between 20181104 and 20181111 :


$ cat z1.f90
program p
   integer :: i
   !$omp teams distribute parallel do
   do i = 1, 2
   end do
end


$ gfortran-10-20191201 -c z1.f90 -fopenmp
during GIMPLE pass: omplower
z1.f90:3:0:

    3 |    !$omp teams distribute parallel do
      |
internal compiler error: Segmentation fault
0xb7c01f crash_signal
        ../../gcc/toplev.c:328
0xa77dc1 gsi_start_1
        ../../gcc/gimple-iterator.h:105
0xa77dc1 lower_omp
        ../../gcc/omp-low.c:12988
0xa86653 lower_omp_taskreg
        ../../gcc/omp-low.c:11253
0xa7a1b7 lower_omp_1
        ../../gcc/omp-low.c:12852
0xa7a1b7 lower_omp
        ../../gcc/omp-low.c:12989
0xa784ee lower_omp_1
        ../../gcc/omp-low.c:12781
0xa784ee lower_omp
        ../../gcc/omp-low.c:12989
0xa7f99b execute_lower_omp
        ../../gcc/omp-low.c:13031
0xa7f99b execute
        ../../gcc/omp-low.c:13079
Comment 1 Martin Liška 2019-12-03 09:38:48 UTC
Confirmed, started with r265930.
Comment 2 Jakub Jelinek 2019-12-03 19:09:32 UTC
It used to be invalid in OpenMP 4.5, but is completely valid in OpenMP 5.0.  Before the above mentioned change, it was the generic code that used to diagnose it as invalid, but that was removed when C/C++ started supporting it.
Easiest is to support in Fortran too, after all, Fortran already gained some OpenMP 5.0 features.
Comment 3 Jakub Jelinek 2019-12-03 19:12:27 UTC
Created attachment 47412 [details]
gcc10-pr92756.patch

Untested fix.
Comment 4 Jakub Jelinek 2019-12-04 08:47:45 UTC
Author: jakub
Date: Wed Dec  4 08:47:13 2019
New Revision: 278956

URL: https://gcc.gnu.org/viewcvs?rev=278956&root=gcc&view=rev
Log:
	PR fortran/92756
	* trans-openmp.c (gfc_trans_omp_teams): Wrap OMP_TEAMS body into a
	BIND_EXPR with a forced BLOCK.

	* gfortran.dg/gomp/teams1.f90: New test.

	* testsuite/libgomp.fortran/teams1.f90: New test.
	* testsuite/libgomp.fortran/teams2.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/gomp/teams1.f90
    trunk/libgomp/testsuite/libgomp.fortran/teams1.f90
    trunk/libgomp/testsuite/libgomp.fortran/teams2.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-openmp.c
    trunk/gcc/testsuite/ChangeLog
    trunk/libgomp/ChangeLog
Comment 5 Jakub Jelinek 2019-12-04 08:51:27 UTC
Fixed on the trunk so far.
Comment 6 Jakub Jelinek 2019-12-20 17:35:51 UTC
Author: jakub
Date: Fri Dec 20 17:35:18 2019
New Revision: 279666

URL: https://gcc.gnu.org/viewcvs?rev=279666&root=gcc&view=rev
Log:
	PR fortran/92756
	* omp-low.c (check_omp_nesting_restrictions): If lang_GNU_Fortran,
	diagnose teams not closely nested inside of target.

	Backported from mainline
	2019-12-04  Jakub Jelinek  <jakub@redhat.com>

	PR fortran/92756
	* gfortran.dg/gomp/teams1.f90: New test.

Added:
    branches/gcc-9-branch/gcc/testsuite/gfortran.dg/gomp/teams1.f90
Modified:
    branches/gcc-9-branch/gcc/ChangeLog
    branches/gcc-9-branch/gcc/omp-low.c
    branches/gcc-9-branch/gcc/testsuite/ChangeLog
Comment 7 Jakub Jelinek 2019-12-20 18:30:50 UTC
Fixed for 9.3+ too.