Operating System - OpenVMS
1828456 Members
4095 Online
109978 Solutions
New Discussion

Re: C Pointers - Alpha -> Itanium port - FTAM, OSIF, OSAK

 
CA1296764
Advisor

C Pointers - Alpha -> Itanium port - FTAM, OSIF, OSAK

Hi,

I am working on porting some code to Itanium from Alpha and having problems with pointers.
The code is used for FTAM file transfers using DECnet/OSI and the OSIF and OSAK toolkits

I have the code running on Alpha and also (not yet!) Itanium, in the VAX debugger.

When I get the problematic are of the code I see the following on Alpha and Itanium:

On Alpha
==========
DBG> ex pFtamGen[0]
TESTPROGRAM\Moveit\pFtamGen[0]
iFtamPort: 0
iApiStatus: 0
iFtamStatus: 0
iFtamCommand: -1
iOsifpb: 1
fpdat
[0]: 0
[1]: 0
pcFileName
[0]: 0
[1]: 0
TimeStamp: 1152558485
pParValue: 197012
pSourceSpec: 12658696
pResultpb: 13287432
pOsifpb
[0]: 13213704
[1]: 13139976
[2]: 13066248
[3]: 12992520
pBufferList
[0]: 12771336
RecordInfo
iRecordType: -1
iDataCount
[0]: 0
[1]: 0
iRecordCount
[0]: 0
[1]: 0
scratch
[0]: 0
[1]: 0



On Itanium
==========
DBG> ex pFtamGen[0]
TESTPROGRAM\Moveit\pFtamGen[0]
iFtamPort: 0
iApiStatus: 0
iFtamStatus: 0
iFtamCommand: -1
iOsifpb: 0
fpdat
[0]-[1]: 0
pcFileName
[0]-[1]: 0
TimeStamp: 1152556034
pParValue: 65916
pSourceSpec: 10456320
pResultpb: 11108368
pOsifpb
[0]: 6277101733928783489892973617953757389149798330745408217104
[1]:1461501636991459757530357134052030134282493575184
[2]: 340282366841905693879899832897826594832
[3]: 79228162495863086981675548688
pBufferList
[0]: 16
RecordInfo
iRecordType: -1
iDataCount
[0]-[1]: 0
iRecordCount
[0]-[1]: 0
scratch: ""


The problematic element of the data is pOsifpb, and pBufferList.
On the Alpha platform it is correctly resolved to be an address pointer pointing to another defined structure/array.
On Itanium however the elements are corrupted.

The pointer pFtamGen is then passed into a OSIF_SEND() function call, which works fine on Alpha, but ACCVIOs on Itanium due to the corruption of pOsifpb.

pResultpb is defined of the same type as pOsifpb and seems to work as expected on bith Alpha and Itanium.

Does anyone have any suggestions on how to resolve this and get pOsifpb back to being an address pointer?
How can I look at these variables/types in the debugger to try and spot the problem?

Many thanks
JC
3 REPLIES 3
John Gillings
Honored Contributor

Re: C Pointers - Alpha -> Itanium port - FTAM, OSIF, OSAK

JC,

Where, and how is the structure defined? Is it aligned properly/as expected?

It sometimes helps to examine the "raw" data

DBG> EXAMINE/HEX/QUAD/NOSYMB pFtamGen[0]:pFtamGen[1]

Determine exactly where the fields start and stop. This may identify places where the compiler has aligned fields where you didn't want it to. Symbolic EXAMINE commands hide padding.
A crucible of informative mistakes
CA1296764
Advisor

Re: C Pointers - Alpha -> Itanium port - FTAM, OSIF, OSAK

Hi,

Thanks for the reply.

The structure is defined over several declarations/definitions in Header files,
including typedefs and structs.

The pointer pOsifpb is a pointer to the Osifpb structure type defined in the osif.h from the
DECnet-plus OSIF installation.

All the definitions are the same in the Alpha and Itanium code.

If the problem is alignment, can this this be fixed with compile/link options?
Where can find any porting guidelines around data aligning and how to control this at compile/link?

Anyone out there using the OSIF functions on Itanium, eg OSIF_SEND() ???

Many thanks
JC
Ian Miller.
Honored Contributor

Re: C Pointers - Alpha -> Itanium port - FTAM, OSIF, OSAK

For porting information see
http://h71000.www7.hp.com/doc/82final/6673/6673PRO.html

and other resources at
http://h71000.www7.hp.com/openvms/integrity/resources.html
____________________
Purely Personal Opinion