Bug 517578
| Summary: | gfortran 4.1: Subroutine assumed-shape array dummy args require an explicit interface spec for the caller | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 5 | Reporter: | Jeff Bastian <jbastian> | ||||||
| Component: | gcc | Assignee: | Jakub Jelinek <jakub> | ||||||
| Status: | CLOSED WONTFIX | QA Contact: | BaseOS QE <qe-baseos-auto> | ||||||
| Severity: | medium | Docs Contact: | |||||||
| Priority: | medium | ||||||||
| Version: | 5.4 | CC: | tao | ||||||
| Target Milestone: | rc | ||||||||
| Target Release: | --- | ||||||||
| Hardware: | All | ||||||||
| OS: | Linux | ||||||||
| Whiteboard: | |||||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||||
| Doc Text: | Story Points: | --- | |||||||
| Clone Of: | Environment: | ||||||||
| Last Closed: | 2009-10-28 10:06:12 UTC | Type: | --- | ||||||
| Regression: | --- | Mount Type: | --- | ||||||
| Documentation: | --- | CRM: | |||||||
| Verified Versions: | Category: | --- | |||||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||||
| Embargoed: | |||||||||
| Attachments: |
|
||||||||
|
Description
Jeff Bastian
2009-08-14 19:03:21 UTC
Created attachment 357501 [details]
demo program with required interface
The correct form of the demo program.
--- array_display.f90 2009-08-14 13:31:34.000000000 -0500
+++ array_display_repaired.f90 2009-08-14 13:31:34.000000000 -0500
@@ -3,6 +3,13 @@
integer, parameter:: dp=kind(0.d0)
real(dp), pointer :: p(:)
real(dp) :: x(1000)
+ interface
+ subroutine subr1(y,p)
+ integer, parameter:: dp=kind(0.d0)
+ real(dp), intent(in) :: y(:)
+ real(dp), intent(in) :: p(:)
+ end subroutine subr1
+ end interface
allocate(p(1000))
p(:) = 0._dp
x(:) = 0._dp
@@ -21,6 +28,22 @@
real(dp), allocatable :: ar1(:)
real(dp), allocatable :: ar2(:,:)
integer :: j
+ interface
+ subroutine subr2(r,t,s,u,v,w,ar1,ar2,j,y,p)
+ integer, parameter:: dp=kind(0.d0)
+ real(dp), intent(in) :: r
+ real(dp), intent(in) :: t(3)
+ real(dp), intent(in) :: s
+ real(dp), intent(out) :: u(3)
+ real(dp), intent(in) :: v
+ real(dp), intent(in) :: w
+ real(dp), intent(inout) :: ar1(:)
+ real(dp), intent(inout) :: ar2(:,:)
+ integer, intent(inout) :: j
+ real(dp), intent(in) :: y(:)
+ real(dp), intent(in) :: p(:)
+ end subroutine subr2
+ end interface
i = 4*size(p)
allocate(ar1(i),ar2(3,i))
call subr2(r,t,s,u,v,w,ar1,ar2,j,y,p)
This isn't very different from calling a function which expects say real argument with integer one, etc., and when not using interfaces or modules you get no diagnostics for that either. Even if a diagnostics is added (which would be very involved and risky patch for 4.4 at this point), it wouldn't catch the probably far more usual cases where the subroutine/function definition is in a different source from the caller. Just use INTERFACE and/or MODULEs if you want function/subroutine type checking IMHO. Development Management has reviewed and declined this request. You may appeal this decision by reopening this request. |