- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The following program creates segmentation fault
under ifort 8.1, ifort 9.0 but not under ifc 7.0
PROGRAM BUGSEARCH
CALL gls_corstep_tile(1044574)
CONTAINS
SUBROUTINE gls_corstep_tile(Jend)
integer, intent(in) :: Jend
integer, parameter :: r8 = selected_real_kind(12,300) ! 64-bit
real(r8), dimension(Jend) :: var1
! real(r8), dimension(1044574) :: var1
Print *, 'The program has finished'
END SUBROUTINE gls_corstep_tile
END PROGRAM
The segmentation fault does not happen if 1044574 is replaced by a smaller value and if the value of Jend is replaced directly by its value.
The problem happen under linux 2.4.20-8 and linux 2.6.8-2-686-smp
Mathieu
The following program creates segmentation fault
under ifort 8.1, ifort 9.0 but not under ifc 7.0
PROGRAM BUGSEARCH
CALL gls_corstep_tile(1044574)
CONTAINS
SUBROUTINE gls_corstep_tile(Jend)
integer, intent(in) :: Jend
integer, parameter :: r8 = selected_real_kind(12,300) ! 64-bit
real(r8), dimension(Jend) :: var1
! real(r8), dimension(1044574) :: var1
Print *, 'The program has finished'
END SUBROUTINE gls_corstep_tile
END PROGRAM
The segmentation fault does not happen if 1044574 is replaced by a smaller value and if the value of Jend is replaced directly by its value.
The problem happen under linux 2.4.20-8 and linux 2.6.8-2-686-smp
Mathieu
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are exceeding the stack limit for the large automatic array. Try this instead:
This will use dynamic allocation for the variable and should allow much larger allocations without worrying about stack size. The array will be automatically deallocated on exit of the subroutine.
PROGRAM BUGSEARCH
CALL gls_corstep_tile(1044574)
CONTAINS
SUBROUTINE gls_corstep_tile(Jend)
integer, intent(in) :: Jend
integer, parameter :: r8 = selected_real_kind(12,300) ! 64-bit
real(r8), allocatable, dimension(:) :: var1
! real(r8), dimension(1044574) :: var1
allocate (var1(jend))
Print *, 'The program has finished'
END SUBROUTINE gls_corstep_tile
END PROGRAM
This will use dynamic allocation for the variable and should allow much larger allocations without worrying about stack size. The array will be automatically deallocated on exit of the subroutine.
![](/skins/images/71A9511A625CE5D5D45FB59952A4AA71/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page