Compile time errors/warnings


exists there a warning in newer version of pgf95 (I have only access to 6.0-5)? If not, can they be added in future versions?

a) Wrong format string

program test
implicit none
integer :: n
n = 1
write(*,’(’‘n’’)’) n
end program test

pgf95 does compile without any error/warning (and produces only the run time error: “PGFIO-F-246/formatted write/unit=6/infinite format scan for edit descriptor.”)
Expected: Something like the NAG compiler:

Error: test1.f90, line 5: No data-edit descriptor for effective item
[f95 error termination]

If it could catch something like
c = ‘(’‘n’’)’
write(*,c) n
as well, it would be even nicer (NAG misses that as well).

b) Interface check

module test
implicit none
subroutine hello(n)
integer :: n
end subroutine hello
end interface
end module test

subroutine hello(n)
integer, intent(in) :: n
integer :: i
do i = 1,n; print *, ‘hello’; end do
end subroutine hello

In the interface “n” is implicitly “intent(inout)”, in the function it is “intent(in)”.
pgf95 gives no error, but NAG f95 does:

Error: test3.f90: Inconsistent INTERFACE block for procedure HELLO from TEST
Argument N (no. 1) has a different INTENT
[f95 error termination]


PS: Using different compilers is really a bonus to find programming errors. pgf95 is especially good at finding array boundary problems:
n = 0
b = a(1)
works with most compilers (creates one element and accesses this one), but with pgf95 is simply cashes (and -Mbounds tells why).

Hi Tobias,

Our latest release (6.1) does not detect these types of errors. I have submitted a request (TPR#3820) to our compiler engineers and hopefully we will be able to add support for these in the near future.