Bug 77666 - ICE in gfc_omp_clause_default_ctor, at fortran/trans-openmp.c:471
Summary: ICE in gfc_omp_clause_default_ctor, at fortran/trans-openmp.c:471
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 7.0
: P3 normal
Target Milestone: ---
Assignee: Jakub Jelinek
URL:
Keywords: openmp
Depends on:
Blocks:
 
Reported: 2016-09-20 17:55 UTC by Gerhard Steinmetz
Modified: 2017-05-30 09:17 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2016-09-20 00:00:00


Attachments
gcc7-pr77666.patch (635 bytes, patch)
2016-09-26 15:20 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-09-20 17:55:04 UTC
Affects versions down to at least 4.8 :


$ cat z1.f90
subroutine s(x)
   integer, allocatable :: x(:)
   integer :: q
   q = 0
!$omp parallel private(x) reduction(+:q)
   q = q + sum(x)
!$omp end parallel
   print *, q
end


$ cat z2.f90
subroutine s(x)
   integer, allocatable :: x(:)
   logical :: q
   q = .false.
!$omp parallel private(x) reduction(.or.:q)
   q = q .or. any (x > 0)
!$omp end parallel
   print *, q
end


$ _g2d_nofo_v7test -fopenmp -c z1.f90
z1.f90:5:0:

 !$omp parallel private(x) reduction(+:q)

internal compiler error: in gfc_omp_clause_default_ctor, at fortran/trans-openmp.c:471
0x78f7b6 gfc_omp_clause_default_ctor(tree_node*, tree_node*, tree_node*)
        ../../gcc/fortran/trans-openmp.c:471
0xb25a4b lower_rec_input_clauses
        ../../gcc/omp-low.c:4953
0xb2a17d lower_omp_taskreg
        ../../gcc/omp-low.c:15661
0xb1c0e6 lower_omp_1
        ../../gcc/omp-low.c:17036
0xb1c0e6 lower_omp
        ../../gcc/omp-low.c:17180
0xb1b44c lower_omp_1
        ../../gcc/omp-low.c:17019
0xb1b44c lower_omp
        ../../gcc/omp-low.c:17180
0xb1bdec lower_omp_1
        ../../gcc/omp-low.c:17028
0xb1bdec lower_omp
        ../../gcc/omp-low.c:17180
0xb22fcf execute_lower_omp
        ../../gcc/omp-low.c:17915
0xb22fcf execute
        ../../gcc/omp-low.c:17952
Comment 1 Martin Liška 2016-09-20 20:34:01 UTC
All releases that I have are affected (4.5.0+).
Comment 2 Jakub Jelinek 2016-09-26 15:20:11 UTC
Created attachment 39689 [details]
gcc7-pr77666.patch

Untested fix.
Comment 3 Jakub Jelinek 2016-09-27 07:53:00 UTC
Author: jakub
Date: Tue Sep 27 07:52:28 2016
New Revision: 240522

URL: https://gcc.gnu.org/viewcvs?rev=240522&root=gcc&view=rev
Log:
	PR fortran/77666
	* trans-openmp.c (gfc_omp_private_outer_ref): Return true even for
	references to allocatable arrays.

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

Added:
    trunk/gcc/testsuite/gfortran.dg/gomp/pr77666.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-openmp.c
    trunk/gcc/testsuite/ChangeLog
Comment 4 Jakub Jelinek 2016-12-07 22:34:37 UTC
Author: jakub
Date: Wed Dec  7 22:34:05 2016
New Revision: 243388

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

	PR fortran/77666
	* trans-openmp.c (gfc_omp_private_outer_ref): Return true even for
	references to allocatable arrays.

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

Added:
    branches/gcc-6-branch/gcc/testsuite/gfortran.dg/gomp/pr77666.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 5 Jakub Jelinek 2016-12-08 09:32:07 UTC
Fixed for 6.3+ as well.
Comment 6 Jakub Jelinek 2017-05-30 07:30:34 UTC
Author: jakub
Date: Tue May 30 07:29:49 2017
New Revision: 248613

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

	PR fortran/77666
	* trans-openmp.c (gfc_omp_private_outer_ref): Return true even for
	references to allocatable arrays.

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

Added:
    branches/gcc-5-branch/gcc/testsuite/gfortran.dg/gomp/pr77666.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 2017-05-30 09:17:42 UTC
Fixed.