PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Segmentation fault at end subroutine

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
Ian Thompson (UK)



Joined: 20 May 2014
Posts: 2

PostPosted: Wed May 21, 2014 2:46 am    Post subject: Segmentation fault at end subroutine Reply with quote

I'm using Free PGI under OS X 10.7.5 (with XCode 4.6.3). The output from pgfortran -v is

Quote:
pgfortran 14.3-0 64-bit target on Apple OS/X developer $INFOTPVAL
The Portland Group - PGI Compilers and Tools
Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved


The following code triggers a segmentation fault after write (*,*) "END SUBROUTINE", but before write (*,*) "RETURNED OK"

Code:
module my_module

implicit none

!-----

type :: my_type

  type (my_type) , pointer :: next => null()

  contains

  procedure , pass :: f

end type

!-----

contains

!-----

  subroutine f( obj )

    class (my_type) , intent (inout) :: obj

  end subroutine

!-----

  subroutine process( obj )

    type (my_type) , intent (inout) , target :: obj

    !-----

    type (my_type) , pointer :: test => null()
    type (my_type) , pointer :: tmp  => null()

    !-----

    write (*,*) associated( obj % next )
    test => obj % next
    write (*,*) associated( test )

    call test % f()

    !-----

    write(*,*) "END SUBROUTINE"
  end subroutine

!-----

end module

!*****

program main

use my_module

implicit none

!-----

type (my_type) :: obj

allocate( obj % next )

call process( obj )
write (*,*) "RETURNED OK"

!-----

end program


I can't see any reason for this, and the problem does not occur if gfortran or nagfor is used. Therefore I think this is a bug in pgfortran.
Back to top
View user's profile
cparrott



Joined: 02 May 2011
Posts: 146

PostPosted: Wed May 21, 2014 2:37 pm    Post subject: Reply with quote

Hi Ian,

Thanks for the report. I'll investigate this and see if I can reproduce the issue here. If so, then I'll file a bug report with our developers. Will keep you posted.

Best regards,

+chris
Back to top
View user's profile
jtull



Joined: 30 Jun 2004
Posts: 438

PostPosted: Fri Jul 25, 2014 3:50 pm    Post subject: TPR 20472 - Fortran code segfaults with method call Reply with quote

TPR 20472 - Fortran code segfaults with method call
has been fixed as of the 14.7 release.

Thanks for the problem submission.

regards,
dave
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