Re: why doesn't this compile ?



Bart Vandewoestyne wrote:
I am cleaning up my directory with test and example programs, and I came
across the following testprogram that I've written somewhere in the past:

http://www.cs.kuleuven.ac.be/~bartv/downloads/test_array_arguments.f95

I guess I wanted to demonstrate to myself how to write a function that
can act on arrays of both rank 1 and rank 2, but unfortunately this
thing doesn't compile anymore.

If i compile it with my F-compiler I get:

Error: test_array_arguments.f95, line 39: F_2 declared as an array in host but is a procedure
       detected at FUNCTION@F_2
[...]
I've been playing around, but could not get it to compile yet... I've been
staring for too long at it and now it's probably too late in the evening ;-)
Does anybody see what I'm doing wrong?

I get a similar set of errors under HP Fortran V7.6-3276-48D52 under Alpha/VMS 7.3-1:

--------------------------------------------------------------------
Khfairfi> f90/stan=f95 TEST_ARRAY_ARGUMENTS.F95

function f_2(x) result (y)
..............^
%F90-E-ERROR, The name of the internal procedure conflicts with a name in the en
compassing scoping unit. [F_2]
at line number 39 in file PTD$USRK:[KHFAIRFI]TEST_ARRAY_ARGUMENTS.F95;1


function f_1(x) result (y)
..............^
%F90-E-ERROR, The name of the internal procedure conflicts with a name in the en
compassing scoping unit. [F_1]
Khfairfi>
--------------------------------------------------------------------


I looks to me like your attempt to define a generic function interface
within the main program is running afoul of the contained proccedures.

    This would have worked pretty transparently if the interface and
the contained procedures were in a separate module, but the attempt
to put them altogether in a single procedure isn't working so well...
Is this what Richard Maine was talking about in anther thread this
morning, the difficulty of defining correct interface blocks in certain
situations?  What surprizes me is that this ever worked for you!

	-Ken
--
I don't speak for Intel, Intel doesn't speak for me...

Ken Fairfield
D1C Automation VMS System Support
who:   kenneth dot h dot fairfield
where: intel dot com
.