http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60522

            Bug ID: 60522
           Summary: WHERE construct causes an ICE in gfc_trans_where_2
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: roger.ferrer at bsc dot es

Hi,

the following code

! -- test.f90
subroutine foo(a, b)
   implicit none
   integer, dimension(:), intent(inout) :: a
   integer, dimension(:), intent(in) :: b

   where (b(:) > 0)
      a(lbound(a, 1):ubound(a, 1)) = b(lbound(b, 1):ubound(b, 1)) * b(lbound(b,
1):ubound(b, 1))
   end where
end subroutine foo
! -- end of test.f90

causes an ICE if optimization is enabled:

$ gfortran -c test.f90 -O
test.f90: In function ‘foo’:
test.f90:6:0: internal compiler error: in gfc_trans_where_2, at
fortran/trans-stmt.c:4550
    where (B(:) > 0)
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.

The problem goes away if the assignment is of the (equivalent) form:

 a(:) = b(:) * b(:)

or

 a = b * b

or if optimization is disabled.

Kind regards,

Reply via email to