This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/47984] New: Pointer dummy argument mismatch not detected by Fortran compiler
- From: "thenlich at users dot sourceforge.net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 4 Mar 2011 08:31:03 +0000
- Subject: [Bug fortran/47984] New: Pointer dummy argument mismatch not detected by Fortran compiler
- Auto-submitted: auto-generated
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)