Bug 517574
Summary: | gfortran 4.4: Subroutine assumed-shape array dummy args require an explicit interface spec for the caller | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Jeff Bastian <jbastian> | ||||||
Component: | distribution | Assignee: | RHEL Program Management <pm-rhel> | ||||||
Status: | CLOSED CURRENTRELEASE | QA Contact: | Ben Levenson <benl> | ||||||
Severity: | medium | Docs Contact: | |||||||
Priority: | medium | ||||||||
Version: | 7.0 | CC: | cww, tgummels, woodard | ||||||
Target Milestone: | alpha | Keywords: | Reopened | ||||||
Target Release: | --- | ||||||||
Hardware: | All | ||||||||
OS: | Linux | ||||||||
Whiteboard: | |||||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||||
Doc Text: | Story Points: | --- | |||||||
Clone Of: | Environment: | ||||||||
Last Closed: | 2012-05-07 20:11:11 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: | |||||||||
Bug Depends On: | |||||||||
Bug Blocks: | 502912, 819062 | ||||||||
Attachments: |
|
Description
Jeff Bastian
2009-08-14 18:48:03 UTC
Created attachment 357493 [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)
Other compilers do give an error, for example: $ pathf90 -g -O0 -o array_display_64_pathf90_3.1-g-O0 array_display.f90 subroutine subr1(y,p) ^ pathf95-1277 pathf90: ERROR SUBR1, File = array_display.f90, Line = 12, Column = 12 Procedure "SUBR1" is referenced at line 9 (array_display.f90). It must have an explicit interface specified. subroutine subr2(r,t,s,u,v,w,ar1,ar2,j,y,p) ^ pathf95-1277 pathf90: ERROR SUBR2, File = array_display.f90, Line = 29, Column = 12 Procedure "SUBR2" is referenced at line 26 (array_display.f90). It must have an explicit interface specified. pathf95: PathScale(TM) Fortran Version 3.1 (f14) Thu Aug 13, 2009 15:08:15 pathf95: 45 source lines pathf95: 2 Error(s), 0 Warning(s), 0 Other message(s), 0 ANSI(s) pathf95: "explain pathf95-message number" gives more information about each message $ /usr/local/tools/pathscale/bin/explain pathf95-1277 Error : Procedure "%s" is %s at line %s. It must have an explicit interface specified. 12.3.1.1 The Fortran standard requires an explicit interface in the following situations: A procedure other than a statement function shall have an explicit interface if the procedure is elemental or the procedure has (a) An optional dummy argument (b) A dummy argument that is an assumed-shape array, a pointer or a target (c) An array-valued result (functions only.) (d) A result that is a pointer (functions only) (e) A result whose character length parameter value is not assumed and not constant During global semantics the compiler has detected a call to an external procedure and has found an explicit interface for that procedure in another program unit during compilation. The explicit interface for that procedure describes the procedure as having one or more of the above characteristics. These characteristics require that an explicit interface be specified for this program unit in all program units that reference this procedure. Oops, that should be gfortran44 in the steps to reproduce: Steps to Reproduce: 1. gfortran44 -g -Wall -o array_display array_display.f90 See bug 517578 for the gfortan-4.1 clone of this bug. This request was evaluated by Red Hat Product Management for inclusion, but this component is not scheduled to be updated in the current Red Hat Enterprise Linux release. If you would like this request to be reviewed for the next minor release, ask your support representative to set the next rhel-x.y flag to "?". Fix not backportable to RHEL6 gcc, will be only wheneven gcc46-gfortran is added as a TechPreview (not earlier than next year). Development Management has reviewed and declined this request. You may appeal this decision by reopening this request. I can confirm that gcc 4.6.3 in F16 detects the error properly. Therefore DTS and RHEL7 a1 should be OK. [ben@snog Downloads]$ gfortran test-assumed.f95 test-assumed.f95:26.12: call subr2(r,t,s,u,v,w,ar1,ar2,j,y,p) 1 Error: Procedure 'subr2' at (1) with assumed-shape dummy argument 'ar1' must have an explicit interface test-assumed.f95:9.12: call subr1(x,p) 1 Error: Procedure 'subr1' at (1) with assumed-shape dummy argument 'y' must have an explicit interface [ben@snog Downloads]$ gcc --version gcc (GCC) 4.6.3 20120306 (Red Hat 4.6.3-2) Copyright (C) 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |