1752671 Members
5620 Online
108789 Solutions
New Discussion юеВ

Re: RPCGEN on IA64

 
Nick Kemp
Occasional Contributor

RPCGEN on IA64

Is there a reason that RPCGEN generates code that is wrong.

I have a int in my .x and the encode function correctly uses xdr_int but the decode function decides to use IDXR_GET/PUT_LONG

Surely an int is an int and a long is a long.
When i then compile the generated code then generates warnings such as

warning #4229-D: 64 bit migration: conversion from "long" to "int" may truncate value
objp->workstate = IXDR_GET_LONG(buf);

warning #4229-D: 64 bit migration: conversion from "ulong_t" to "int32_t" may truncate value
IXDR_PUT_LONG(buf, objp->workstate);

I can see no new options to rpcgen.

Thx
4 REPLIES 4
Dennis Handly
Acclaimed Contributor

Re: RPCGEN on IA64

>Surely an int is an int and a long is a long. When i then compile the generated code then generates warnings such as

What are you asking? If you are not compiling with +DD64, you can ignore those warnings.
Nick Kemp
Occasional Contributor

Re: RPCGEN on IA64

Sorry I did not state that I am compiling with +DD64.

I can not see anyway to get rid of these errors. It would seem that compiling as 64 bit has been taken into account.

Some of the other generated code has it correctly using xdr_int for the encode for an int but IXDR_PUT_LONG for the decode.

Is there something I am misunderstanding.?

Is the source to the HP RPCGEN available to try and work out what it is doing when it is doing the code generation?

Thx
Dennis Handly
Acclaimed Contributor

Re: RPCGEN on IA64

>I can not see anyway to get rid of these errors. It would seem that compiling as 64 bit has been taken into account.

Well, if these are 32 bit values, they should be using int, not long. You can get rid of the warnings by adding casts.

>Some of the other generated code has it correctly using xdr_int for the encode for an int but IXDR_PUT_LONG for the decode.

This doesn't seem nice.
Something seems wrong with those warnings. For the first 4229 it seems that workstate is a 32 bit int field. But from the second it seems that it is now a ulong_t?
Are IXDR_GET_LONG and IXDR_PUT_LONG macros that could be having problems?

You may want to compile with +legacy_cpp if you suspect macros.

>Is the source to the HP RPCGEN available

I have no clue. If you think there is a problem, why not report it to the Response Center?
Do you have some sample input?
Nick Kemp
Occasional Contributor

Re: RPCGEN on IA64

I think I will have to report it.

I have downloaded of the sun site the open source to RPCGEN and it includes a define for _LP64 and then uses INT32 instead of long and long if not _LP64.

Seems like an oversite.

Thx