Bug 71705 - [4.9 Regression] ICE in lower_omp_target, at omp-low.c:16136
Summary: [4.9 Regression] ICE in lower_omp_target, at omp-low.c:16136
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 6.1.1
: P3 normal
Target Milestone: 4.9.4
Assignee: Jakub Jelinek
URL:
Keywords: openmp
Depends on:
Blocks:
 
Reported: 2016-06-29 18:37 UTC by Gerhard Steinmetz
Modified: 2016-07-08 07:23 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2016-06-30 00:00:00


Attachments
gcc7-pr71705.patch (534 bytes, patch)
2016-06-30 11:00 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gerhard Steinmetz 2016-06-29 18:37:29 UTC
With a missing save attribute :


$ cat z1.f90
subroutine s
   real :: x
   x = 0.0
   !$omp target update to(x)
   !$omp target
   x = x + 1.0
   !$omp end target
end


$ gfortran-6 -g -O0 -Wall -fcheck=all -fopenmp -c z1.f90
z1.f90:4:0:

    !$omp target update to(x)

internal compiler error: in lower_omp_target, at omp-low.c:16135
Comment 1 Gerhard Steinmetz 2016-06-29 18:38:09 UTC
Compiles with save status :

$ cat z2.f90
subroutine s
   real, save :: x
   !!$omp declare target(x)
   x = 0.0
   !$omp target update to(x)
   !$omp target
   x = x + 1.0
   !$omp end target
end
Comment 2 Martin Liška 2016-06-30 08:19:01 UTC
Confirmed, ICE started with GCC 4.9.1, former releases report:

/home/marxin/Programming/testcases/pr71705.f90:4.9:

   !$omp target update to(x)
         1
Error: Unclassifiable OpenMP directive at (1)
/home/marxin/Programming/testcases/pr71705.f90:5.9:

   !$omp target
         1
Error: Unclassifiable OpenMP directive at (1)
/home/marxin/Programming/testcases/pr71705.f90:7.9:

   !$omp end target
         1
Error: Unclassifiable OpenMP directive at (1)
Comment 3 Jakub Jelinek 2016-06-30 11:00:00 UTC
Created attachment 38801 [details]
gcc7-pr71705.patch

This used to be invalid in OpenMP 4.0 (for Fortran even GCC 6 supports only OpenMP 4.0), but is valid (though completely useless) in OpenMP 4.5 (the target update directive actions are ignored).  That said, we shouldn't ICE on it.
Comment 4 Jakub Jelinek 2016-06-30 17:40:23 UTC
Author: jakub
Date: Thu Jun 30 17:39:52 2016
New Revision: 237887

URL: https://gcc.gnu.org/viewcvs?rev=237887&root=gcc&view=rev
Log:
	PR fortran/71705
	* trans-openmp.c (gfc_trans_omp_clauses): Set TREE_ADDRESSABLE on
	decls in to/from clauses.

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

Added:
    trunk/gcc/testsuite/gfortran.dg/gomp/pr71705.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-openmp.c
    trunk/gcc/testsuite/ChangeLog
Comment 5 Jakub Jelinek 2016-07-02 10:23:19 UTC
Author: jakub
Date: Sat Jul  2 10:22:48 2016
New Revision: 237941

URL: https://gcc.gnu.org/viewcvs?rev=237941&root=gcc&view=rev
Log:
	Backported from mainline
	2016-06-30  Jakub Jelinek  <jakub@redhat.com>

	PR fortran/71705
	* trans-openmp.c (gfc_trans_omp_clauses): Set TREE_ADDRESSABLE on
	decls in to/from clauses.

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

Added:
    branches/gcc-6-branch/gcc/testsuite/gfortran.dg/gomp/pr71705.f90
Modified:
    branches/gcc-6-branch/gcc/fortran/ChangeLog
    branches/gcc-6-branch/gcc/fortran/trans-openmp.c
    branches/gcc-6-branch/gcc/testsuite/ChangeLog
Comment 6 Jakub Jelinek 2016-07-07 12:49:36 UTC
Author: jakub
Date: Thu Jul  7 12:49:04 2016
New Revision: 238102

URL: https://gcc.gnu.org/viewcvs?rev=238102&root=gcc&view=rev
Log:
	Backported from mainline
	2016-06-30  Jakub Jelinek  <jakub@redhat.com>

	PR fortran/71705
	* trans-openmp.c (gfc_trans_omp_clauses): Set TREE_ADDRESSABLE on
	decls in to/from clauses.

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

Added:
    branches/gcc-5-branch/gcc/testsuite/gfortran.dg/gomp/pr71705.f90
Modified:
    branches/gcc-5-branch/gcc/fortran/ChangeLog
    branches/gcc-5-branch/gcc/fortran/trans-openmp.c
    branches/gcc-5-branch/gcc/testsuite/ChangeLog
Comment 7 Jakub Jelinek 2016-07-07 13:22:04 UTC
Fixed also for 5.5+.
Comment 8 Jakub Jelinek 2016-07-07 21:54:25 UTC
Author: jakub
Date: Thu Jul  7 21:53:53 2016
New Revision: 238146

URL: https://gcc.gnu.org/viewcvs?rev=238146&root=gcc&view=rev
Log:
	Backported from mainline
	2016-06-30  Jakub Jelinek  <jakub@redhat.com>

	PR fortran/71705
	* trans-openmp.c (gfc_trans_omp_clauses): Set TREE_ADDRESSABLE on
	decls in to/from clauses.

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

Added:
    branches/gcc-4_9-branch/gcc/testsuite/gfortran.dg/gomp/pr71705.f90
Modified:
    branches/gcc-4_9-branch/gcc/fortran/ChangeLog
    branches/gcc-4_9-branch/gcc/fortran/trans-openmp.c
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
Comment 9 Jakub Jelinek 2016-07-08 07:23:41 UTC
Fixed.