Quantcast
Channel: Recent posts
Viewing all articles
Browse latest Browse all 415

segmentation fault with PACK function

$
0
0

$ cat test_pack.f90
program test

  implicit none
 
  integer, parameter :: m = 1050000
  integer, allocatable :: a(:),b(:),c(:),d(:)

  integer :: i

  allocate(a(0:m),b(0:m),c(0:m),d(0:m))

  do i=0,m
    a(i) = i
    b(i) = 0
  end do

  d = pack(a,b == 1,c)

  deallocate(a,b,c,d)
 
end program test
$ ifort -V test_pack.f90
Intel(R) Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 17.0.1.132 Build 20161005
Copyright (C) 1985-2016 Intel Corporation.  All rights reserved.

 Intel(R) Fortran 17.0-1632
GNU ld version 2.25.1-22.base.el7
$ ./a.out
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image              PC                Routine            Line        Source             
a.out              00000000004744F1  Unknown               Unknown  Unknown
a.out              000000000047262B  Unknown               Unknown  Unknown
a.out              000000000043D3D4  Unknown               Unknown  Unknown
a.out              000000000043D1E6  Unknown               Unknown  Unknown
a.out              000000000041E1F9  Unknown               Unknown  Unknown
a.out              00000000004031C6  Unknown               Unknown  Unknown
libpthread-2.17.s  00007F416A398370  Unknown               Unknown  Unknown
a.out              0000000000402CFE  Unknown               Unknown  Unknown
a.out              000000000040295E  Unknown               Unknown  Unknown
libc-2.17.so       00007F4169FE9B35  __libc_start_main     Unknown  Unknown
a.out              0000000000402869  Unknown               Unknown  Unknown

It works with m = 1040000. the presence of the vector (c in pack(a,b == 1,c)) also has an effect on how large m can be without giving the problem.

 


Viewing all articles
Browse latest Browse all 415

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>