This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/15809] ICE Using Pointer Functions
- From: "sven dot buijssen at math dot uni-dortmund dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Nov 2005 18:06:46 -0000
- Subject: [Bug fortran/15809] ICE Using Pointer Functions
- References: <bug-15809-7776@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #15 from sven dot buijssen at math dot uni-dortmund dot de 2005-11-21 18:06 -------
I cannot tell why, but it seems to me that Paul Thomas' test case is no valid
code:
* Compaq Fortran Compiler X5.4A-1684-46B5P gives:
f90: Warning: line 14: An explicit-shaped array is being passed to a routine
that expects a pointer or assumed-shape array
call a (ptr)
----------^
Ok, that's because of the spare dummy argument l in the subroutine definition.
Omitting it, Compaq compiles, decides that p is associated, but prints an empty
string.
* Same behaviour with g95 (Nov 12 2005): empty string
* Next compiler: Sun Fortran 95 8.1 Patch 117834-03 2005/06/15
The Sun Compiler totally refuses to compile Paul Thomas' test case (but
omitting the spare dummy argument l):
call a (ptr)
^
Line = 14, Column = 3: ERROR: Procedure "A" is defined at line 1. It must have
an explicit interface specified.
f90comp: 16 SOURCE LINES
f90comp: 1 ERRORS, 0 WARNINGS, 0 OTHER MESSAGES, 0 ANSI
* Rewriting the code to something equivalent
program demo
character(8), dimension (:), pointer :: ptr
character(8), dimension (2), target :: tar
tar = "def"
ptr => tar
call a (ptr)
if (associated (ptr)) print *, "in MAIN, ptr = ", ptr
contains
subroutine a(p)
character(8), dimension(:), pointer :: p
if (associated (p)) then
print *, p
else
print *, "not associated"
end if
end subroutine a
end program demo
solves all problems. g95, gfortran (20051113), ifort 9.0, Sun + Compaq Compiler
smoothly compile and print to screen the desired:
def def
in MAIN, ptr = def def
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15809