PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Segmentation fault with "pack" intrinsic

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
Keith Refson



Joined: 10 Jul 2006
Posts: 14

PostPosted: Thu Oct 11, 2012 4:11 am    Post subject: Segmentation fault with "pack" intrinsic Reply with quote

I think I have found another compiler bug - it appears to generate wrong code.

The following code gives a run-time segfault, although I believe it to be correct. (It runs to completion when compiled with Intel, GNU, Sun/Oracle, NAG, Pathscale and open64 Fortran). The segfault appears internal to "pack", and turning on -Mchkptr appears to diagnose an error with a compiler-generated array.

This occurs with pgf90 v 12.9 on linux x86_64 at any opti mization level.



Code:

program packtest
  integer, parameter :: n=36
  logical, dimension(n,2) :: mask_0
  logical, dimension(:), allocatable :: mask
  integer, dimension(:),allocatable :: rank, tmp

  integer :: nzero, k

  allocate(rank(n), tmp(n), mask(n))
  mask_0 = reshape(&
         [.TRUE.,.TRUE.,.TRUE., .FALSE.,.TRUE.,.TRUE.,.TRUE.,.TRUE.,.TRUE.,&
          .TRUE., .FALSE.,.TRUE.,.TRUE.,.TRUE.,.TRUE.,.TRUE.,.TRUE., .FALSE.,&
          .FALSE.,.TRUE.,.TRUE.,.TRUE.,.TRUE.,.TRUE.,.TRUE., .FALSE.,.TRUE.,&
          .TRUE.,.TRUE.,.TRUE.,.TRUE.,.TRUE., .FALSE.,.TRUE.,.TRUE.,.TRUE.,&
          .TRUE.,.TRUE.,.TRUE., .FALSE.,.TRUE.,.TRUE.,.TRUE.,.TRUE.,.TRUE.,&
          .TRUE., .FALSE.,.TRUE.,.TRUE.,.TRUE.,.TRUE.,.TRUE.,.TRUE., .FALSE.,&
          .FALSE.,.TRUE.,.TRUE.,.TRUE.,.TRUE.,.TRUE.,.TRUE., .FALSE.,.TRUE.,&
          .TRUE.,.TRUE.,.TRUE.,.TRUE.,.TRUE., .FALSE.,.TRUE.,.TRUE.,.TRUE.],[n,2])

  do k = 0,1
     write(*,*) k
     rank = 0
     mask = mask_0(:,k+1)
     nzero = count(mask)

     tmp(1:nzero)   = pack(rank, mask)
     tmp(nzero+1:n) = pack(rank, .not. mask)
     rank = tmp
  end do

  write(*,*) rank

end program packtest
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 5815
Location: The Portland Group Inc.

PostPosted: Thu Oct 11, 2012 9:40 am    Post subject: Reply with quote

Hi Keith,

This looks like the same issue first report HERE and logged as TPR#18937. The good news is that a fix will be available in 12.10 which will be available very soon.

- Mat

Code:
% pgf90 pack.f90 -V12.9
% a.out
            0
Segmentation fault
% pgf90 pack.f90 -V12.10
% a.out
            0
            1
            0            0            0            0            0            0
            0            0            0            0            0            0
            0            0            0            0            0            0
            0            0            0            0            0            0
            0            0            0            0            0            0
            0            0            0            0            0            0
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group