- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Community,
I have encountered some weird phenomenon involving Fortran array operations. The following code
PROGRAM test IMPLICIT NONE INTEGER, PARAMETER :: dp = 8 INTEGER, PARAMETER :: N = 10 INTEGER :: i, no_onedir_points, no_quadrature_points REAL(dp), DIMENSION(1:N*N) :: w REAL(dp), DIMENSION(1:n) :: gw no_onedir_points = N no_quadrature_points = N*N DO i = 1, N gw( i ) = REAL( i, dp ) ENDDO ! i w( 1:no_quadrature_points ) = & PACK( ARRAY=SPREAD( SOURCE=gw(1:no_onedir_points), & DIM=2, & NCOPIES=no_onedir_points ) * & SPREAD( SOURCE=gw(1:no_onedir_points), & DIM=1, & NCOPIES=no_onedir_points ), & MASK=.TRUE. ) WRITE(*,*) gw WRITE(*,*) w END PROGRAM test
is a (rather simplified) snippet from a FEM code to generate some tensor products of arrays.
Compiling it by Intel Fortan 2015 Update 3 (ifort version 15.0.3) the resulting code suffers segfault at the call to PACK. Turning to Intel Fortran 2015 (ifort version 15.0.1) yields the same. However, if the code above is compiled with Intel Fortran 2013 SP1 Update 3 (ifort version 14.0.2) then everything works fine and the expected result is produced.
Moreover, if I modify the above code to avoid the "embedded" calls to SPREAD within PACK using a temporary array
PROGRAM test IMPLICIT NONE INTEGER, PARAMETER :: dp = 8 INTEGER, PARAMETER :: N = 10 INTEGER :: i, no_onedir_points, no_quadrature_points REAL(dp), DIMENSION(1:N*N) :: w REAL(dp), DIMENSION(1:N,1:N) :: data REAL(dp), DIMENSION(1:n) :: gw no_onedir_points = N no_quadrature_points = N*N DO i = 1, N gw( i ) = REAL( i, dp ) ENDDO ! i data(1:no_onedir_points,1:no_onedir_points) = & SPREAD( SOURCE=gw(1:no_onedir_points), & DIM=2, & NCOPIES=no_onedir_points ) * & SPREAD( SOURCE=gw(1:no_onedir_points), & DIM=1, & NCOPIES=no_onedir_points ) w( 1:no_quadrature_points ) = & PACK( ARRAY=data(1:no_onedir_points,1:no_onedir_points), & MASK=.TRUE. ) WRITE(*,*) gw WRITE(*,*) w END PROGRAM test
then everything is going fine with ifort version 15.0.3.
Am I doing something wrong, or is this a bug somewhere?
Thank you for your help,
Jozsef
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
See https://software.intel.com/en-us/forums/topic/559308
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page