[Dwarf-discuss] F9x elemental procedures

James Cownie jcownie
Wed Jun 8 04:43:55 GMT 2005


David's replies are pretty much on the mark.

For full details of how this works in F95, see section 12.5 of the
standard, or (more easily) section 12.5 of the "Fortran 95 Handbook" on
page 467.

There are a few minor corrections 

> >Is this describing a function declaration that describes a compiler-builtin?
> 
> Yes, in some cases (at least one).
> It's more like the implied-do of a non-builtin (?).

I'd say no, it's not describing a compiler built in. 
Or, rather it's not necessary to describe a compiler built in, since
those aren't normally described in the DWARF, so there's nowhere to
describe them, and, since they're in the language spec the debugger
already has all the knowledge it needs to be able to call them.

David is, however, right that many of the Fortran intrinsics are elemental.

FWIW we already handle those in TotalView.
This from the current beta release Totalview shows us applying the sin
and atan2 intrinsics on a two element array

d1.<> dprint sin(r4_a)
 sin (r4_a)      = {
   (1) = -0.97753
   (2) = 0.79849
 }
d1.<> dprint atan2(r4_a,1.0) 
 atan2 (r4_a, 1.0) = {
   (1) = 1.3521
   (2) = 1.4537
 }

> >Will a debugger be expected to call these functions in a special way
> >if it has support for such "elemental" functions?
> 
> Looks to me like the debugger must do the iteration and call the
> implementing function  once for each element. (hmm. well
> it gets messy as some arg could be a scalar and other be
> an array.)

Yes, that's the whole point of giving the debugger the information. It
allows the debugger to know that it should be able to call a function
which has scalar formals even though it is called with array actuals and
one would therefore think that the argument types didn't match. 

The problem this is solving is that the user can write elemental
procedures (functions/subroutines), but the debugger has no way of
discovering which procedures are elemental.

-- 
-- Jim
--
James Cownie	<jcownie at etnus.com>
Etnus, LLC.     +44 117 9071438
http://www.etnus.com





More information about the Dwarf-discuss mailing list