Re: Possible Fortran 8.2 compiler bug on Itanium (653 Views)
Reply
Trusted Contributor
Jeremy Begg
Posts: 380
Registered: ‎01-20-2005
Message 1 of 11 (917 Views)

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

Please use plain text.
Honored Contributor
Steven Schweda
Posts: 9,084
Registered: ‎02-23-2005
Message 2 of 11 (907 Views)

Re: Possible Fortran 8.2 compiler bug on Itanium

Please use plain text.
Trusted Contributor
Jeremy Begg
Posts: 380
Registered: ‎01-20-2005
Message 3 of 11 (897 Views)

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.
Please use plain text.
Frequent Advisor
Eberhard Heuser
Posts: 42
Registered: ‎03-19-2010
Message 4 of 11 (879 Views)

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

Please use plain text.
Trusted Contributor
Jeremy Begg
Posts: 380
Registered: ‎01-20-2005
Message 5 of 11 (874 Views)

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

Please use plain text.
Valued Contributor
Fekko Stubbe
Posts: 36
Registered: ‎08-17-2003
Message 6 of 11 (856 Views)

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)

Please use plain text.
Trusted Contributor
abrsvc
Posts: 363
Registered: ‎06-08-2010
Message 7 of 11 (825 Views)

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
Please use plain text.
Valued Contributor
Fekko Stubbe
Posts: 36
Registered: ‎08-17-2003
Message 8 of 11 (796 Views)

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.

Please use plain text.
Valued Contributor
Mike Kier
Posts: 102
Registered: ‎05-18-2003
Message 9 of 11 (770 Views)

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
Please use plain text.
Regular Visitor
John Brodribb
Posts: 3
Registered: ‎11-06-2003
Message 10 of 11 (745 Views)

Re: Possible Fortran 8.2 compiler bug on Itanium

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

Please use plain text.
Honored Contributor
John Gillings
Posts: 2,994
Registered: ‎07-31-2003
Message 11 of 11 (653 Views)

Re: Possible Fortran 8.2 compiler bug on Itanium

Jeremy,

 

   If only all "I've found a compiler bug" reports were so well researched, characterised and documented with such a simple and unarguable reproducer! :-)

A crucible of informative mistakes
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation