Fortran 2003 C Interop Question

This is for someone in Sun's Fortran compiler group.

I just downloaded the Aug. build 2 of Sun Studio Express for Linux and was playing around with the FORTRAN/C Interoperability features. I've encountered a problem with the BIND(C) suffix that I think is a violation of the standard or at least the DRAFT standard on j3-fortran. sunf95 requires me to put a comma between the closing paren of the subroutine argument list and the BIND(C) suffix.

Example

Subroutine csub (ni, a), BIND(C)

The draft standard does not show that the comma is required (I don't think it is).

g95 doesn't allow the comma. I think Cray's X1 compiler makes it optional. So who is following the actual standard? Sun, g95, or Cray.

Also, when will the IMPORT statement appear in the Sun Studio compilers.

Thanks

[841 byte] By [csmdoc] at [2007-11-26 9:38:13]
# 1

> This is for someone in Sun's Fortran compiler group.

>

> I just downloaded the Aug. build 2 of Sun Studio

> Express for Linux and was playing around with the

> FORTRAN/C Interoperability features. I've encountered

> a problem with the BIND(C) suffix that I think is a

> violation of the standard or at least the DRAFT

> standard on j3-fortran. sunf95 requires me to put a

> comma between the closing paren of the subroutine

> argument list and the BIND(C) suffix.

>

> Example

>

>Subroutine csub (ni, a), BIND(C)

> The draft standard does not show that the comma is

> required (I don't think it is).

> g95 doesn't allow the comma. I think Cray's X1

> compiler makes it optional. So who is following the

> actual standard? Sun, g95, or Cray.

Sun's Fortran behavior is not conformed to latest version of Fortran 2003 standard and will be fixed. Thanks for feedback

>

> Also, when will the IMPORT statement appear in the

> Sun Studio compilers.

We have it in our plans but there is not concrete date of release with support of this feature

Alex

>

> Thanks

alexey_shubin at 2007-7-7 0:32:58 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 2
Hello,I am trying the Sun compiler on linux x86 (version 8.3) and I am finding that it still erronously requires a comma before BIND(C). Any specific plans on when this will be fixed?Thanks,Aleksandar Donev
aleksdonev at 2007-7-7 0:32:58 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 3
HiIt will be fixed in upcoming Sun Studio eXpress releases.You can watch status of this bug at bug.sun.com, bug ID 6462772 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6462772Alex
alexey_shubin at 2007-7-7 0:32:58 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 4

Hi,

I am trying to get Sun to compile our Fortran 2003 OpenGL interface (http://www-stone.ch.cam.ac.uk/pub/f03gl/), and am finding some more problems with Interop.

One additional issue is that Sun f95 has not updated interop to separate function and data pointersTYPE(C_FUNPTR) is not recognized. Even replacing C_FUNLOC with C_LOC for now, it seems that C_LOC does accept procedure arguments. For example,

SUBROUTINE glutDisplayFunc_f03(func)

INTERFACE

SUBROUTINE func(), BIND(C)

USE ISO_C_BINDING; USE OpenGL_kinds

END SUBROUTINE func

END INTERFACE

OPTIONAL :: func

IF(PRESENT(func)) THEN

CALL glutDisplayFunc_gl(C_LOC(func))

ELSE

CALL glutDisplayFunc_gl(C_NULL_PTR)

END IF

END SUBROUTINE glutDisplayFunc_f03

Thanks,

Aleks

aleksdonev at 2007-7-7 0:32:58 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 5

Thanks for feedback

It looks like a bug in ISO_C_BINDING module

Of course, we will fix it.

Big ID is 6479962, you can look current status of this bug at bugs.sun.com

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6479962

Anything else? Fell free to report any problem with our compiler

Alex

alexey_shubin at 2007-7-7 0:32:58 > top of Java-index,Development Tools,Solaris and Linux Development Tools...