Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Perverse G77 syntax extension

11 views
Skip to first unread message

Dr Ivan D. Reid

unread,
May 9, 2008, 5:27:12 PM5/9/08
to
A message came by on a CERN mailing list today regarding compiling
our application framework on GCC4, which necessarily entails switching
from G77 to gfortran.

The code that barfed was a declaration:

COMPLEX FUNCTION LI2*16(X)

I tried it and it _is_ accepted by G77 (but not by gfortran).

Out of which left-field did this extension come?

--
Ivan Reid, School of Engineering & Design, _____________ CMS Collaboration,
Brunel University. Ivan.Reid@[brunel.ac.uk|cern.ch] Room 40-1-B12, CERN
KotPT -- "for stupidity above and beyond the call of duty".

Michael Metcalf

unread,
May 9, 2008, 5:58:28 PM5/9/08
to

"Dr Ivan D. Reid" <Ivan...@brunel.ac.uk> wrote in message
news:slrng29gdg.4...@loki.brunel.ac.uk...

> A message came by on a CERN mailing list today regarding compiling
> our application framework on GCC4, which necessarily entails switching
> from G77 to gfortran.
>
> The code that barfed was a declaration:
>
> COMPLEX FUNCTION LI2*16(X)
>
> I tried it and it _is_ accepted by G77 (but not by gfortran).
>
> Out of which left-field did this extension come?
>

My test input for convert.f90 contains

complexfunctionx1*16(i)

and I think it came from IBM.


Regards,

Mike Metcalf

glen herrmannsfeldt

unread,
May 9, 2008, 6:06:25 PM5/9/08
to
Dr Ivan D. Reid wrote:
> A message came by on a CERN mailing list today regarding compiling
> our application framework on GCC4, which necessarily entails switching
> from G77 to gfortran.

> The code that barfed was a declaration:
>
> COMPLEX FUNCTION LI2*16(X)

> I tried it and it _is_ accepted by G77 (but not by gfortran).

> Out of which left-field did this extension come?

That is, at least, the form used by the OS/360 Fortran compilers.

The form COMPLEX*16 FUNCTION LI2(X) does not seem to be allowed.

On variable declarations one can override the length such as:

REAL*8 BAKER, HOLD, VALUE*4, ITEM(5,5)

such that VALUE is REAL*4, the rest are REAL*8.

Specifying the length on individual CHARACTER variables
seems to still work, but FUNCTION statements don't seem to
work that way.

CHARACTER FUNCTION S*10(X)

doesn't seem to be legal.

-- glen

John Harper

unread,
May 11, 2008, 5:56:59 PM5/11/08
to
In article <EKqdnQNcTbAVVLnV...@comcast.com>,

glen herrmannsfeldt <g...@ugcs.caltech.edu> wrote:
>Dr Ivan D. Reid wrote:
>>
>> COMPLEX FUNCTION LI2*16(X)
>
>> I tried it and it _is_ accepted by G77 (but not by gfortran).
>
>> Out of which left-field did this extension come?
>
>That is, at least, the form used by the OS/360 Fortran compilers.
>
>The form COMPLEX*16 FUNCTION LI2(X) does not seem to be allowed.

The IBM VS Fortran manual of Feb 1981 gave on p.109 an IBM
extension to f77 allowing a function statement to be something like
COMPLEX FUNCTION f*16(z) but not like COMPLEX*16 FUNCTION f(z)
In g77 on Intel i386 NetBSD both forms work: the following prints
1.3333333333333333 -0.3333333333333333
with that compiler:

* Test nonstandard *16 syntax
COMPLEX*16 f
PRINT "(2F20.16)",f((4.0d0,-1.0d0))
END
COMPLEX*16 FUNCTION f(z)
COMPLEX*16 z
f = z/3
END

and so does the same program with COMPLEX*16 FUNCTION f(z) replaced by
COMPLEX FUNCTION f*16(z)
but of course a standard-conforming compiler, whether f77 f90 f95 or
f2003, is free to reject either form.

-- John Harper, School of Mathematics, Statistics and Computer Science,
Victoria University, PO Box 600, Wellington 6140, New Zealand
e-mail john....@vuw.ac.nz phone (+64)(4)463 6780 fax (+64)(4)463 5045

0 new messages