PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

pgfortran ICE when using type-bound operator from a module

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



Joined: 15 Sep 2013
Posts: 15

PostPosted: Tue Mar 11, 2014 1:52 pm    Post subject: pgfortran ICE when using type-bound operator from a module Reply with quote

The following code generates an internal compiler error with pgfortran 13.9:

Code:

module bound_op_mod

implicit none

type foo
   integer :: n
 contains
   procedure, pass(f1) :: sum_this => sum_foo
   generic, public :: operator(+) => sum_this
end type foo

contains

function sum_foo(f1, f2) result(new_f)
  class(foo), intent(in) :: f1, f2
  type(foo) :: new_f

  new_f = foo(f1%n + f2%n)

end function sum_foo

end module bound_op_mod

program test_bound_operator

use bound_op_mod, only: foo

implicit none

type(foo) :: f

f = foo(1) + foo(2)

print *, f

end program test_bound_operator


The error messages are:

Quote:
PGF90-S-0000-Internal compiler error. mkexpr1: bad id 14 (pgi_internal_error.F90: 9)
PGF90-S-0000-Internal compiler error. sym_of_ast: unexpected ast 0 (pgi_internal_error.F90: 9)
PGF90-S-0155-Type bound procedure must be a module procedure or an external procedure with an explicit interface - (pgi_internal_error.F90: 9)
PGF90-S-0000-Internal compiler error. sym_of_ast: unexpected ast 0 (pgi_internal_error.F90: 9)


("pgi_internal_error.F90" was the name of the file I put this test case in.)

On one machine with PGI 13.9, the compiler hangs after this point. On another machine with 13.7, it manages to error out without hanging. I have (much more complex) code that successfully uses type-bound operators with PGI 13.7, so it's not at all clear to me what the issue is in this simple case.
Back to top
View user's profile
mkcolg



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

PostPosted: Thu Mar 13, 2014 12:57 pm    Post subject: Reply with quote

Hi Sean Patrick Santos,

Thanks for the report. I've recreated the issue here and sent it on to engineering for further investigation (TPR#19990).

Here's a work around until we can get the issue resolved.

Code:
module bound_op_mod

implicit none

type foo
   integer :: n
 contains
   procedure, pass(f1) :: sum_this => sum_foo
   generic, public :: operator(+) => sum_this
end type foo

contains

function sum_foo(f1, f2) result(new_f)
  class(foo), intent(in) :: f1, f2
  type(foo) :: new_f

  new_f = foo(f1%n + f2%n)

end function sum_foo

end module bound_op_mod

program test_bound_operator

use bound_op_mod, only: foo

implicit none

type(foo) :: f, f1, f2

f1 = foo(1)
f2 = foo(2)
f = f1 + f2
!f = foo(1) + foo(2)

print *, f

end program test_bound_operator


Best Regards,
Mat
Back to top
View user's profile
jtull



Joined: 30 Jun 2004
Posts: 445

PostPosted: Mon Jun 16, 2014 5:14 pm    Post subject: TPR 19990 has been fixed in the 14.6 release. Reply with quote

TPR 19990 - UF: pgfortran ICE when using type-bound operator from a module

has been fixed in the current 14.6 release.

thanks,
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