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

purity and interface

0 views
Skip to first unread message

robert....@sun.com

unread,
May 23, 2003, 12:38:52 AM5/23/03
to
Consider the program

PROGRAM TEST
EXTERNAL FOO
REAL FOO
INTERFACE SUBR
SUBROUTINE SUB(FOO)
INTERFACE
PURE FUNCTION FOO()
END FUNCTION
END INTERFACE
END SUBROUTINE
END INTERFACE
CALL SUBR(FOO)
END

SUBROUTINE SUB(FOO)
INTERFACE
PURE FUNCTION FOO()
END FUNCTION
END INTERFACE
END

PURE FUNCTION FOO()
FOO = 1.0
END

This program violates the fifth constraint given in Section 12.6 of the
Fortran 95 standard. Up to the latest release of Sun f95, Sun f95
detected an error in this program and gave a none too clear error
message for the error. The new release of Sun f95 gives no error
message for this program.

Someone has asserted that Sun f95 is the only compiler he has tried that
ever detected this constraint violation. He further asserted that if we
were to again give an error message for it, users porting codes from
other compilers would think Sun f95 is the faulty compiler.

I would like to know if any compilers other than Sun f95 detect this
constraint violation.

Sincerely,
Bob Corbett

Christoph Arns

unread,
May 23, 2003, 1:12:46 AM5/23/03
to
>
> I would like to know if any compilers other than Sun f95 detect this
> constraint violation.

emorph:~/TMP> f95 -version
Compaq Fortran X5.4A-1684
Compaq Fortran Compiler X5.4A-1684-46B5P
emorph:~/TMP> uname -a
OSF1 emorph V5.1 1885 alpha alpha

emorph:~/TMP> f95 foo.f90
(no complains)
emorph:~/TMP> f95 -check all foo.f90
(no complains)
emorph:~/TMP> f95 -warn all foo.f90
f90: Warning: foo.f90, line 7: This name has not been given an explicit
type. [FOO]
PURE FUNCTION FOO()
----------------------------^
f90: Warning: foo.f90, line 17: This name has not been given an explicit
type. [FOO]
PURE FUNCTION FOO()
------------------------^
f90: Warning: foo.f90, line 22: This name has not been given an explicit
type. [FOO]
PURE FUNCTION FOO()
--------------------^


Christoph

--------------------------------------------------------------------------
Dr. Christoph Arns
Dept. Applied Mathematics
Research School of Physical Sciences and Engineering
The Australian National University
Canberra ACT 0200 AUSTRALIA
Ph.: +61 (2) 6125 5170
Fax: +61 (2) 6125 0732
http://rsphysse.anu.edu.au/appmaths

Jan C. Vorbrüggen

unread,
May 23, 2003, 3:06:38 AM5/23/03
to
CVF 6.6B behaves analogously. In addition, specifying /stand:f95 does
not generate any warnings or errors.

Jan

Ian Bush

unread,
May 23, 2003, 9:24:35 AM5/23/03
to
robert....@sun.com wrote:

> Consider the program

SNIP !

>
> This program violates the fifth constraint given in Section 12.6 of the
> Fortran 95 standard. Up to the latest release of Sun f95, Sun f95
> detected an error in this program and gave a none too clear error
> message for the error. The new release of Sun f95 gives no error
> message for this program.
>

SNIP !

>
> I would like to know if any compilers other than Sun f95 detect this
> constraint violation.
>

IBM:

Wot now ? lslpp -l | grep -i xlf
xlfcmp 7.1.1.2 COMMITTED XL Fortran Compiler
xlfrte 7.1.1.2 COMMITTED XL Fortran Runtime
xlfrte.aix43 7.1.1.2 COMMITTED XL Fortran Runtime Environment
xlfrte.aix51 7.1.1.2 COMMITTED XL Fortran Runtime Environment
xlfcmp 7.1.1.0 COMMITTED XL Fortran Compiler

Wot now ? xlf95 -qsuffix=f=f90 -qlanglvl=95pure test.f90
** test === End of Compilation 1 ===
** sub === End of Compilation 2 ===
** foo === End of Compilation 3 ===
1501-510 Compilation successful for file test.f90.

Ian

Andy Spragg

unread,
May 23, 2003, 8:52:46 AM5/23/03
to
On Fri, 23 May 2003 04:38:52 +0000 (UTC), robert....@sun.com ()
wrote:

>Consider the program

(snip)

>I would like to know if any compilers other than Sun f95 detect this
>constraint violation.

Using Salfords FTN95 with these options: /DCLVAR, /FULL_DEBUG,
/IMPLICIT_NONE, /UNDEF gives:

[FTN95/Win32 Ver. 3.4.2160 <ANDY> Copyright (C) Salford Software Ltd
1993-2003]
Licensed to: Dr Andy Spragg
Organisation: RHM TECHNOLOGY LIMITED

0005) SUBROUTINE SUB(FOO)
*** FOO must appear in a type declaration because IMPLICIT NONE has
been used
1 ERROR [<TEST> FTN95/Win32 v3.4.2160 <ANDY>]
0015) SUBROUTINE SUB(FOO)
*** FOO must appear in a type declaration because IMPLICIT NONE has
been used
1 ERROR [<SUB> FTN95/Win32 v3.4.2160 <ANDY>]
0022) PURE FUNCTION FOO()
*** FOO must appear in a type declaration because IMPLICIT NONE has
been used
1 ERROR [<FOO> FTN95/Win32 v3.4.2160 <ANDY>]
*** Compilation failed

HTH
--
Andy Spragg
RHM Technology Ltd

I think therefore I am what I eat

Herman D. Knoble

unread,
May 23, 2003, 9:13:58 AM5/23/03
to
Under Windows ...
Oddly enough Salford FTN95 Version 3.4.0 with options:
/DEBUG /CHECK /FULL_UNDEF /FULL_DEBUG
yields the run-time error message:

Runtime error from program:c:\hdk\fortex\corbett.exe
Run-time Error
Attempt to call a routine with argument number one
as a procedure when a real(kind=1) was required

SUB - in file corbett.f90 at line 13 [+003d]

main - in file corbett.f90 at line 12 [+003f]

Without the debug options it runs the program with no messages
as does code generated by Lahey LF95 5.70c and CVF 6.6b.

Skip Knoble, Penn State

On Fri, 23 May 2003 04:38:52 +0000 (UTC), robert....@sun.com () wrote:

-|Consider the program
-|
-| PROGRAM TEST
-| EXTERNAL FOO
-| REAL FOO
-| INTERFACE SUBR
-| SUBROUTINE SUB(FOO)
-| INTERFACE
-| PURE FUNCTION FOO()
-| END FUNCTION
-| END INTERFACE
-| END SUBROUTINE
-| END INTERFACE
-| CALL SUBR(FOO)
-| END
-|
-| SUBROUTINE SUB(FOO)
-| INTERFACE
-| PURE FUNCTION FOO()
-| END FUNCTION
-| END INTERFACE
-| END
-|
-| PURE FUNCTION FOO()
-| FOO = 1.0
-| END
-|
-|This program violates the fifth constraint given in Section 12.6 of the
-|Fortran 95 standard. Up to the latest release of Sun f95, Sun f95
-|detected an error in this program and gave a none too clear error
-|message for the error. The new release of Sun f95 gives no error
-|message for this program.
-|
-|Someone has asserted that Sun f95 is the only compiler he has tried that
-|ever detected this constraint violation. He further asserted that if we
-|were to again give an error message for it, users porting codes from
-|other compilers would think Sun f95 is the faulty compiler.
-|
-|I would like to know if any compilers other than Sun f95 detect this
-|constraint violation.
-|
-| Sincerely,
-| Bob Corbett


Herman D. (Skip) Knoble, Research Associate
(a computing professional for 38 years)
Mailto:h...@psu.edu
Web: http://www.personal.psu.edu/hdk
Penn State Information Technology Services
Academic Services and Emerging Technologies
Graduate Education and Research Services
Penn State University
214C Computer Building
University Park, PA 16802-21013
Phone:+1 814 865-0818 Fax:+1 814 863-7049

Massimiliano Fatica

unread,
May 23, 2003, 1:03:36 PM5/23/03
to
On MacosX,
Absoft v7 compiles the code.

NAG gives an error

[bladerunner:~/fortran] fatica% /usr/local/bin/f95 pure.f90
Warning: pure.f90, line 20: Unused dummy procedure FOO
detected at END@<end-of-statement>
[f95 continuing despite warning messages]
Error: pure.f90, line 12: No specific match for reference to generic SUBR
[f95 error termination]


Massimiliano

In article <bak8ks$nu2$1...@news1nwk.SFbay.Sun.COM>,

Catherine Rees Lay

unread,
May 23, 2003, 5:11:21 AM5/23/03
to
writes

Salford FTN95 3.0 doesn't give any errors or warnings.
--
Catherine Rees Lay

Steve Lionel

unread,
May 29, 2003, 9:45:28 AM5/29/03
to
On Fri, 23 May 2003 04:38:52 +0000 (UTC), robert....@sun.com () wrote:

>Consider the program
>
[snip]


>
>This program violates the fifth constraint given in Section 12.6 of the
>Fortran 95 standard. Up to the latest release of Sun f95, Sun f95
>detected an error in this program and gave a none too clear error
>message for the error. The new release of Sun f95 gives no error
>message for this program.
>
>Someone has asserted that Sun f95 is the only compiler he has tried that
>ever detected this constraint violation. He further asserted that if we
>were to again give an error message for it, users porting codes from
>other compilers would think Sun f95 is the faulty compiler.

I notice that none of the standards mavens have weighed in on this.

In my opinion, an error message is clearly warranted in this situation. I
notice your example used a generic interface, but Compaq Fortran blithely lets
it by even if generics aren't used. I have submitted this as a bug report
against Compaq Fortran (and thus it will propagate to Intel Fortran) asking
that a meaningful error message be given.

If someone would like to argue against this, I'm listening...

Please send Visual Fortran support requests to vf-su...@compaq.com

Steve Lionel
Software Products Division
Intel Corporation
Nashua, NH

User communities for Intel Fortran and Compaq Visual Fortran:
http://intel.com/IDS/community

0 new messages