https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83953
Bug ID: 83953
Summary: Internal compiler error with -fcheck=bounds option on
derived type components and forall construct
Product: gcc
Version: 7.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: norio.takemoto at gmail dot com
Target Milestone: ---
Created attachment 43197
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43197&action=edit
Fortran source code main_t000.f90 to reproduce the issue
I encountered an `internal compiler error: Segmentation fault` when I tried to
compile a Fortran code which contains a forall construct involving derived type
components with `-fcheck=bounds` option. Some of the derived type components
are allocatable arrays. I do not see the error if I turn off the
`-fcheck=bounds` option. I saw this error with gfortran 7.2.0 on Ubuntu 17.10
and gfortran 5.4.0 on Ubuntu 16.04.
I attach a sample code `main_t000.f90`. The problem will be reproduced by
compiling it by
gfortran -std=f2008 -fcheck=bounds main_t000.f90
The error reads as following.
$ gfortran -std=f2008 -fcheck=bounds main_t000.f90
main_t000.f90:49:0:
forall(js=lbound(self%obsed_val,1):ubound(self%obsed_val,1))
internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.
$
I am aware of similar bug reports such as
Bug 27766 (Fortran_bounds_checking) - [meta-bug] -fbounds-check related bugs
Bug 81095 - fcheck=bounds and empty forall
Bug 36683 - -fbounds-check failure for allocated array and spread
but I was not able to decide if the present one originates from a common
problem. I wish you could kindly look into the issue.