Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

segfault with omp reduction

valery_w_
Beginner
693 Views

dear all

the following code is segfaulting.

thanks

v

ifort -v
ifort version 14.0.1

 

cat ifort_14.0.1_reduction.f90
program test
  interface
    subroutine sub (a, c, n)
      integer :: n
      integer, allocatable :: a(:), c(:)
    end subroutine
  end interface

  integer, allocatable :: a(:), c(:)
  integer :: i, j
  allocate (a(5), c(5))
  call sub (a, c, 5)
end program test

subroutine sub (a, c, n)
  integer :: n
  integer, allocatable :: a(:), c(:)
!$omp parallel do shared(a) reduction(+:c)
  do i = 1, n
    c(a(i)) = c(a(i)) + 1
  end do
end subroutine sub

ifort -openmp ifort_14.0.1_reduction.f90
ifort_14.0.1_reduction.f90: catastrophic error: **Internal compiler error: segmentation violation signal raised** Please report this error along with the circumstances in which it occurred in a Software Problem Report.  Note: File and line given may not be explicit cause of this error.
compilation aborted for ifort_14.0.1_reduction.f90 (code 1)

 


 

0 Kudos
4 Replies
jimdempseyatthecove
Honored Contributor III
693 Views

You are using a(i) as and index of c(:)

Although a and c have been allocated, a has not been initialized (i.e. you are using junk indexes from a(i))

Jim Dempsey

0 Kudos
valery_w_
Beginner
693 Views

does that explain the ICE?

0 Kudos
Steven_L_Intel1
Employee
693 Views

No, it doesn't. I will report the ICE to the developers. Issue ID is DPD200250515. I assume your complaint is about the internal compiler error and not execution of the code.

0 Kudos
TimP
Honored Contributor III
693 Views

As the ICE goes away with -fno-inline-functions, I buy Jim's suggestion that interprocedural optimization on undefined data may be implicated.  Of course, it would be desirable for the compiler to give some diagnostic rather than an ICE.

This seems to be a difficult corner of OpenMP.  Note that the corresponding C version isn't allowed.

0 Kudos
Reply