Here are some bugs I’ve seen recently in PGI 14.1. I’m not sure if these are all still in 14.3, since I don’t have an updated installation handy. Several of these test cases also break with ifort, so I have open bugs with Intel as well, but they still work with the NAG compiler and gfortran.
The bugs are all apparent by compiling these cases with no flags, or with no flags except “-c” for those that have no main program.
- There’s an ICE when compiling the following simple (but invalid) Fortran module. The module is invalid because either do_nothing should accept a class(foo) argument, or the “nopass” attribute should be present on its binding. But the compiler segfaults instead of reporting a useful error.
module test_types
type :: foo
contains
procedure :: do_nothing
end type foo
contains
subroutine do_nothing()
end subroutine do_nothing
end module test_types
- PGI has some problem with structure constructors for types that extend types with bound procedures. In short, it rejects the following valid code:
module test_types
implicit none
type :: foo
contains
procedure :: do_nothing
end type foo
type, extends(foo) :: bar
integer :: a
end type bar
contains
subroutine do_nothing(self)
class(foo) :: self
end subroutine do_nothing
end module test_types
program test_pgi_construct
use test_types
implicit none
type(bar) :: x
x = bar(1)
print *, x%a
end program test_pgi_construct
- PGI 14.1 also gives a spurious warning in the following case, though the compiled code appears to work correctly:
program test_section_constructor
implicit none
type, abstract :: foo_base
end type foo_base
type, extends(foo_base) :: foo
integer, allocatable :: a(:)
end type foo
type(foo) :: b
integer :: a1(2) = 0
integer :: a2(2,2) = 0
b = foo(a1) ! OK
b = foo(a2(:,1)) ! Spurious warning
end program test_section_constructor
- Using a structure constructor for a type with a procedure pointer gives a spurious warning, but more importantly, calling the function bound to that pointer produces an ICE.
module int_getter
implicit none
contains
integer function foo_int()
foo_int = 0
end function foo_int
end module int_getter
program test_function_constructor
use int_getter, only: foo_int
implicit none
abstract interface
integer function get_int()
end function get_int
end interface
type :: foo
procedure(get_int), nopass, pointer :: get => null()
end type foo
type(foo) :: bar
bar = foo(foo_int) ! This gives a warning, but shouldn't.
bar%get => foo_int ! No warning (this is my current workaround for Intel)
print *, bar%get() ! Internal compiler error
end program test_function_constructor
- This is similar code to case (4), but it has a different problem; the apparently valid structure constructor is rejected outright. I think this is just an unimplemented feature?
module int_getter
implicit none
contains
subroutine foo_int(a)
integer, intent(out) :: a
a = 0
end subroutine foo_int
end module int_getter
program test_function_constructor
use int_getter, only: foo_int
implicit none
abstract interface
subroutine get_int(a)
integer, intent(out) :: a
end subroutine get_int
end interface
type :: foo
procedure(get_int), nopass, pointer :: get => null()
end type foo
type(foo) :: bar
integer :: x
! This line is valid code, but is rejected.
bar = foo(foo_int)
bar%get => foo_int
call bar%get(x)
print *, x
end program test_function_constructor