I'm looking for a way to have a FORTRAN subroutine use character descriptors in
the 64-bit format without touching the source code, but there seems to be no
such commandline switch:
$ FORTRAN/DESCRIPTOR_SIZE=64 ! would be fine
The problem is that we have lots of FORTRAN sources that may have character
variables as parameters. Calling such a subroutine with a parameter that has a
32-bit address is fine, while calling it with another parameter with a 64-bit
address wouldn't work, because the descriptor formats are different.
One way would be to use INTERFACE definitions for _all_ the subroutines that are
subject to receive parameters in the 32-bit and/or the 64-bit format and to
modify each subroutine to accept 64-bit descriptors. :-(
There _must_ be a better way, right? Can anybody help? I must be missing something.
The program I'm just porting to Itanium must use variables in the 64-bit address
space ( !DEC$ ATTRIBUTES ADDRESS64 :: ... ) for _some_ variables (big tables
in memory), however the problem is not IA64 specific, but also applies to Alpha.
This is on an HP rx1620 ... running OpenVMS V8.2,
with HP Fortran V8.0-48071-50EAE
BTW, "/BY_REF_CALL=routine-list" wouldn't help because we need the parameter
sizes in some cases.
Here is an example FORTRAN main program and subroutine:
$ type test_64.for
C
C Testing 64 bit addressing with character descriptors
C
program test_64
C
implicit none
C
CHARACTER*20 CH1,CH2 ! character strings
C*!DEC$ ATTRIBUTES ADDRESS64 :: CH1 ! not a 64 bit address
!DEC$ ATTRIBUTES ADDRESS64 :: CH2 ! 64 bit address
C
C define interface for show ()
C
INTERFACE
SUBROUTINE SHOW (C)
CHARACTER*(*) C
!DEC$ ATTRIBUTES ADDRESS64 :: C ! define C as 64-bit-descriptor
END SUBROUTINE
END INTERFACE
C
CH1 = 'This is CH1'
CH2 = 'This is CH2'
C
CALL SHOW (CH1) ! ch1 with 32-bit address
CALL SHOW (CH2) ! ch2 with 64-bit address
C
END
C
C Show character string subroutine
C
subroutine show (ch)
C
implicit none
C
CHARACTER*(*) ch
!DEC$ ATTRIBUTES ADDRESS64 :: ch ! 64 bit address
C
write (6,100) ch
100 FORMAT (' String: "',A,'"')
return
end
$ fort test_64
$ link test_64
$ r test_64
String: "This is CH1 "
String: "This is CH2 "
$
This works, as one can see, but I would really, really like to have it work
without the interface definition(s) and without modifying the (example)
subroutine show().
Albrecht Schlosser
I'll check. There was some recent work to add limited 64-bit descriptor
support to GEM on behalf of Fortran. I've forwarded your question to
the right folks and will get back to you.
--
John Reagan
HP Pascal/{A|I}MACRO for OpenVMS Project Leader
Hewlett-Packard Company
> This is on an HP rx1620 ... running OpenVMS V8.2,
> with HP Fortran V8.0-48071-50EAE
How much of Fortran 2003 does HP Fortran V8.0-48071-50EAE support?
Thanks, that's really good news - and a very fast response :-)
But, just to be clear: 64-bit descriptors _are_ working (with CDEC$ directives),
but the default is 32-bit descriptors. What I'm looking for is to change the
_default_ to 64-bit by a commandline switch.
Something like $ CC/POINTER_SIZE=64. Suggestion: $ FORTRAN/DESCRIPTOR_SIZE=64.
Thanks again for your efforts.
Albrecht Schlosser
According to the docs: nothing. See
http://h21007.www2.hp.com/dspp/tech/tech_TechDocumentDetailPage_IDX/1,1701,7155,00.html
and, from the "HP Fortran for OpenVMS Integrity, Version 8.0" SPD:
http://h18000.www1.hp.com/info/SP5618/SP5618PF.PDF
HP Fortran 95/90 supports all of the standards that HP
Fortran 77 supports plus the following new standards:
• ANSI X3.198-1992 (Fortran 90)
• ISO/IEC 1539-1:1997(E) (Fortran 95)
Albrecht
>But, just to be clear: 64-bit descriptors _are_ working (with CDEC$ directives),
>but the default is 32-bit descriptors. What I'm looking for is to change the
>_default_ to 64-bit by a commandline switch.
>
>Something like $ CC/POINTER_SIZE=64. Suggestion: $ FORTRAN/DESCRIPTOR_SIZE=64.
When we added 64-bit descriptor support to Fortran, we did not provide
command-line switches for it. The ADDRESS64 attribute is the only option.
Steve
>How much of Fortran 2003 does HP Fortran V8.0-48071-50EAE support?
Well, it supports all of F95, which makes up a large part of F2003. It also
supports the features from TR15581 which made their way into F2003 -
ALLOCATABLE dummy arguments, function values and components of derived type.
Then there's lots of little things standardized in F2003 which were extensions
earlier, such as VOLATILE.
I certainly can't speak for HP's future plans in this area.
Steve
Oh, that's a pity :-(
But is there still hope?
Albrecht
>>
>> When we added 64-bit descriptor support to Fortran, we did not provide
>> command-line switches for it. The ADDRESS64 attribute is the only option.
>>
>> Steve
>
>Oh, that's a pity :-(
>
>But is there still hope?
Not for me to say. Do note that you can detect which kind of descriptor you
were passed - if the 16-bit length and 32-bit pointer are -1, then it's a
64-bit descriptor.
Steve
> ... Do note that you can detect which kind of descriptor you
> were passed - if the 16-bit length and 32-bit pointer are -1, then it's a
> 64-bit descriptor.
>
> Steve
Yes, I know, and I'm doing this with lots of C functions, which are also called
from FORTRAN. However, in FORTRAN the compiler must do the "dirty work" of
interpreting the descriptor, and that's my problem :-(
BTW, I found another "problem" with subroutines and descriptor types. If a
subroutine includes an interface definition for itself, then it doesn't apply
the 64-bit attribute to its own formal parameter(s).
Example:
SUBROUTINE SHOW (C)
CHARACTER*(*) C
C
C Don't add this:
C
C** !DEC$ ATTRIBUTES ADDRESS64 :: C ! would need source modification
C
C The following could be in an include file without modification
C of each source file:
C
INTERFACE
SUBROUTINE SHOW (C)
CHARACTER*(*) C
!DEC$ ATTRIBUTES ADDRESS64 :: C ! define C as 64-bit-descriptor
END SUBROUTINE
END INTERFACE
C
C body of subroutine show
C
RETURN
END
This results in subroutine SHOW to expect parameter C as a 32-bit descriptor.
However, I would expect the compiler to generate code for a 64-bit descriptor
for parameter C. What would be the intended behavior?
You may ask, why are you doing such things? The answer is that we have some
include files that are included in each source file. If I could include all the
interface definitions in one or more big include file(s), then we would have to
access much less source files. But then, the subroutine SHOW would have to
interpret its own interface definition and apply it to its own formal
parameters, but this seems not to work. Is this a bug or a feature?
Thanks for your help, I appreciate this very much.
Albrecht
>BTW, I found another "problem" with subroutines and descriptor types. If a
>subroutine includes an interface definition for itself, then it doesn't apply
>the 64-bit attribute to its own formal parameter(s).
No surprise - that's not legal Fortran. Or rather, the SHOW you are defining
in the interface is not the same one as the routine you're in.
You cannot define an "interface to self". Within the routine, you can apply
attributes to the dummy arguments, but you can't create an interface block for
yourself.
Steve
Thanks for clarification. I'm still interested in a command line switch (see
post of John Reagan), but if this isn't possible, I know what I have to do :-(
Albrecht
> Thanks for clarification. I'm still interested in a command line switch
> (see post of John Reagan), but if this isn't possible, I know what I
> have to do :-(
I've passed along the suggestion to the right folks here in HP. I have
no idea on the size of the effort and how that might fit into future
plans and schedules.