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

Segmentation fault when using intel ifort v8

livermor
Beginner
378 Views
When running the fortran code (below),
ifort v8 produces a segmentation fault, whereas previous versions do not seem to. This disappears on commenting out the 2nd call to subroutine SHOW. Previous message threads have suggested that this might be something to do with stack size - does this apply here?

Additionally, when the 2nd call is commented out, ifort v8 issues the warning:

In call to SHOW, an array temporary was created for argument #3

Instead of passing VEC(1:N1,1:N2,1), if you pass instead another
allocated array VEC2(1:N1,1:N2) (i.e. of identical size but without the superfluous 3rd dimension) this warning goes away.
(I don't get any warnings with previous ifort versions - perhaps they don't flag this?).

I want to call various BLAS routines with my fortran 90 code, each of which expects an explicitly defined array similar to the subroutine SHOW. The arrays I want to pass are all array segments of the form VEC(1:N1,1:N2,1) rather than VEC2(1:N1,1:N2).
Is there any way of stopping the compiler allocating extra arrays - I am worried that this may slow the code down.

Phil

------------------
CODE BELOW
-------------------


PROGRAM TEST3
IMPLICIT NONE
REAL(KIND = 8), ALLOCATABLE :: VEC(:,:,:)
INTEGER N1, N2
PARAMETER(N1 = 10000, N2 = 1500)

ALLOCATE( VEC(1:N1,1:N2,1:3))

CALL SHOW(N1,N2,VEC(1:N1,1:N2,1))

CALL SHOW(N1,N2,VEC(1:N1,1:N2,1))

DEALLOCATE(VEC)

STOP
CONTAINS

SUBROUTINE SHOW(M1,M2,VECTOR)
IMPLICIT NONE
INTEGER M1,M2
REAL(KIND=8), DIMENSION(M1,M2) :: VECTOR
PRINT*, SIZE(VECTOR)
RETURN
END SUBROUTINE SHOW

END PROGRAM TEST3
0 Kudos
1 Reply
mbkennel
Beginner
378 Views
Try declaring in the receiving subroutine the array as

x(:,:) instead of x(M1,M2)


The rules are really complicated but the simplest way to remember the most common case

a) if you are passing *from* F90/F95, then use colons in
the receiver, x(:,:)

b) if you are passing *from* f77, say from a call back,
then use x(N,*) or x(*) in the receiver
0 Kudos
Reply