[Bug fortran/47984] New: Pointer dummy argument mismatch not detected by Fortran compiler

thenlich at users dot sourceforge.net gcc-bugzilla@gcc.gnu.org
Fri Mar 4 08:31:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47984

           Summary: Pointer dummy argument mismatch not detected by
                    Fortran compiler
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: thenlich@users.sourceforge.net


Created attachment 23539
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23539
Test case

The Fortran compiler does not detect a mismatch between an actual argument (not
a pointer) and a dummy argument in a procedure (which is a pointer, by mistake)
in this example:

program test_pointer
    type :: t
        integer :: i = 7
    end type
    type(t), target :: a
    call testsub(a%i)
contains
    subroutine testsub(p)
        integer, pointer, intent(in) :: p
        print *, p
    end subroutine
end

Result: The program compiles without errors.

Expected result: The compiler should report an error like

test_pointer.f90:6.17:

    call testsub(a%i)
                 1
Error: Actual argument for 'p' must be a pointer at (1)



More information about the Gcc-bugs mailing list