- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear all,
I get a segfault when I compile my code with the option -heap-arrays n (whatever the value of n, even 0).
Here's an example that reproduces this error.
type :: my_t
integer, allocatable :: m(:)
end type my_t
type(my_t), allocatable :: s(:)
s = myalloc_fun ( 10 ) !< KO: segmentation fault
! But OK with a subroutine version of myalloc_fun:
!call myalloc_sub ( 10, s )
! And also OK with a direct call to allocate:
!allocate(s(10)) !< and OK
contains
function myalloc_fun ( n ) result( x )
integer, intent(in) :: n
type(my_t), allocatable :: x(:)
allocate(x(n))
end function myalloc_fun
subroutine myalloc_sub ( n, x )
integer, intent(in) :: n
type(my_t), allocatable, intent(out) :: x(:)
allocate(x(n))
end subroutine myalloc_sub
end
Compiler version: ifx (IFX) 2024.1.2 20240508
(Sorry, I cannot try with the latest version at the moment; I am not the administrator of the computer. But please let me know if this bug also occurs with a more recent version).
ifx alloc.f90 -heap-arrays 0 -traceback
./a.out
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
libpthread-2.31.s 00007FC31804E910 Unknown Unknown Unknown
a.out 000000000040A1C1 Unknown Unknown Unknown
a.out 00000000004093B6 Unknown Unknown Unknown
a.out 000000000040A1EE Unknown Unknown Unknown
a.out 00000000004093B6 Unknown Unknown Unknown
a.out 0000000000404841 _unnamed_main$$ 7 alloc.f90
a.out 000000000040422D Unknown Unknown Unknown
libc-2.31.so 00007FC317E6F24D __libc_start_main Unknown Unknown
a.out 000000000040415A Unknown Unknown Unknown
Thanks
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks for reporting this. The segmentation fault is already fixed in our internal development version, and the fix will be included in the 2025.0 release.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks for reporting this. The segmentation fault is already fixed in our internal development version, and the fix will be included in the 2025.0 release.

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