Operating System - OpenVMS
1748134 Members
3616 Online
108758 Solutions
New Discussion

Re: Possible Fortran 8.2 compiler bug on Itanium

 
Jeremy Begg
Trusted Contributor

Possible Fortran 8.2 compiler bug on Itanium

HIi,

 

I am helping a customer port their Fortran applications from OpenVMS Alpha V7.2-2 to OpenVMS IA64 V8.4.

The code (mostly) compiles cleanly but some programs are giving wrong results.  For example, when compiling and running the attached file (TMINUSPLUS.FOR) we get wrong values displayed:

 

$ sho sym fortran
%DCL-W-UNDSYM, undefined symbol - check validity and spelling
$ fortran tminusplus
$ link tminusplus
$ run tminusplus
         18
         20
         20
         18
         20
         20
$

The value being output by the program should be '20' on every line; '18' is incorrect.

 

It looks like the compiler is evaluatiing the expression

 

    result = FILE.INFO.SEG(1).END - FILE.INFO.SEG(1).START + 1

 

as if it was written

 

    result = FILE.INFO.SEG(1).END - (FILE.INFO.SEG(1).START + 1)

 

and in fact the erroneous instruction, as seen in the Debugger, is

 

    sub         r9 = r9, r10, 1

 

The trailing ", 1" has the effect of subtracting 1 from the result, whereas the expression requires 1 be added to the result.

 

I've tried both the Fortran 8.2 compiler and the 8.2 ECO1 compiler and both give the same results.

I am going to try to report this to HP.  If anyone has seen this before, and/or knows a workaround (which hopefully doesn't require extensive code changes!) I'd like to know about it.

 

Thanks,

Jeremy Begg

10 REPLIES 10
Steven Schweda
Honored Contributor

Re: Possible Fortran 8.2 compiler bug on Itanium

 
Jeremy Begg
Trusted Contributor

Re: Possible Fortran 8.2 compiler bug on Itanium

Thanks for the info, Steven. HP has acknowledged receipt of my support request so we'll see what happens.
Eberhard Heuser
Frequent Advisor

Re: Possible Fortran 8.2 compiler bug on Itanium

There is a newer fortran version available:

 

$ fortran/version
HP Fortran V8.2-104953-50M2N

 

Eberhard

Jeremy Begg
Trusted Contributor

Re: Possible Fortran 8.2 compiler bug on Itanium

Hi Eberhad,

 

That's the Fortran 8.2 ECO1 release, which gives the same results.  In fact that's where we first noticed it.

 

Jeremy

Fekko Stubbe
Valued Contributor

Re: Possible Fortran 8.2 compiler bug on Itanium

I tried this on alpha (8.4) with the same result (error)

$fortran/vers

Hp Fortran v8.2-104679-48H9K

 

If I use the old f77 compiler (fortran/old) the result is correct (all 20s)

$fortran/old/version

HP Fortran 77 V7.6-198-48H9K (this version reports 7.6 while it really is the 8.2 version, another bug)

abrsvc
Respected Contributor

Re: Possible Fortran 8.2 compiler bug on Itanium

The report of V7.6 is correct as the F77 compiler is a completely different image. F90$main is the F90 compiler while FORT$main is the F77 compiler.

Dan
Fekko Stubbe
Valued Contributor

Re: Possible Fortran 8.2 compiler bug on Itanium

You could be right, but the image is installed from the fortran 8.2 kit. This kit installs both the fort$main as the f90$main. I find it highly  confusing. If they wat to distribute different version for the f90 and the f77 compiler they should have deliverd 2 kits. As far aas I rmember  the 8.1 kit distributes an 8.1 version for both compilers.

Mike Kier
Valued Contributor

Re: Possible Fortran 8.2 compiler bug on Itanium

It worked correctly under the Fortran 95 compiler on a much older Alpha version - running OpenVMS Alpha V7.3-2 and Fortran V7.5-1961-48BCD

Practice Random Acts of VMS Marketing
John Brodribb
Regular Visitor

Re: Possible Fortran 8.2 compiler bug on Itanium

This was fixed recently. Please contact your Support Centre for a remedial side image.