HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

FOR$CVT_D_TF causes HPARITH exception

 
john reed_2
Occasional Contributor

FOR$CVT_D_TF causes HPARITH exception

I am helping port a system from VAX to Alpha that uses the translated FORTRAN RTL routine FOR$CVT_D_TF to convert a real*8 to an ascii string showing the value. The source must be compiled with the /TIE and /FLOAT=D_FLOAT and the link is done with /NONATIVE. When the routine is called, it throws an HPARITH exception with a reason code of 2: invalid operation. I set up a handler to see what the FP registers contained and they were zeroed out. The returned values appeared to be correct. The attached code illustrates the problem.
5 REPLIES
John Gillings
Honored Contributor

Re: FOR$CVT_D_TF causes HPARITH exception

John,

One word... Why?

Why are you calling an undocumented internal RTL routine, especially one in a translated RTL?

There are plenty of documented and supported ways of converting binary floating point values.

So what's the real objective here?, and why do you think you need to link with the translated RTL?

If the only reason for compiling /TIE and linking /NONATIVE is to get at FOR$CVT routines, then PLEASE replace them with something supported.

(FWIW, I'm not certain if there is or isn't a bug in the RTL routine or in your code, but it's not that relevant. As long as the RTL routines "work" for the compiler, engineering really doesn't care how they behave if called directly!)
A crucible of informative mistakes
Joseph Huber_1
Honored Contributor

Re: FOR$CVT_D_TF causes HPARITH exception

Well, as to expect with unsupported stuff, You may have luck or You may not:
on my system/fortran combination
Alpha VMS 7.3-1, Fortran V7.5-2630-48C8L,
it works without exception.
http://www.mpp.mpg.de/~huber
Joseph Huber_1
Honored Contributor

Re: FOR$CVT_D_TF causes HPARITH exception

And by the way, the documented OTS$CVTOUT routine does the same as FOR$CVT_D_TF:
I would replace all occurences in the source to be ported.
http://www.mpp.mpg.de/~huber
john reed_2
Occasional Contributor

Re: FOR$CVT_D_TF causes HPARITH exception

For mine, I'd replace this immediately but the customer needs some convincing that this is the best course. Thanks for the stick. I'll use it appropriately.

Joseph, are you sure the handler wasn't entered? I put it in so that I could examine the FP registers. When the handler is entered it prints out the first element of the mechargs array.

jr
Joseph Huber_1
Honored Contributor

Re: FOR$CVT_D_TF causes HPARITH exception

Ah Yes, now I see it also on my system.( My brain just expected an exception register dump.)
http://www.mpp.mpg.de/~huber