This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]