RESULT attribute not working



Hello,

for a helper function I had defined the following interface:

INTERFACE
FUNCTION gasnetf90_ptr_add (ptr, bytes) &
BIND (C) RESULT (retval)
USE, INTRINSIC :: ISO_C_BINDING
IMPLICIT NONE
TYPE (C_PTR) :: retval
TYPE (C_PTR), INTENT (IN) :: ptr
INTEGER (KIND=C_INTPTR_T), INTENT (IN) :: bytes
END FUNCTION gasnetf90_ptr_add
END INTERFACE

Having this interface block verbatim in the calling program, everything
works fine, but as soon as I put this block into a module and USE that
in the caller, the functions return value is always zero.

I changed the interface block into this definition

INTERFACE
FUNCTION gasnetf90_ptr_add (ptr, bytes) &
BIND (C)
USE, INTRINSIC :: ISO_C_BINDING
IMPLICIT NONE
TYPE (C_PTR) :: gasnetf90_ptr_add
TYPE (C_PTR), INTENT (IN) :: ptr
INTEGER (KIND=C_INTPTR_T), INTENT (IN) :: bytes
END FUNCTION gasnetf90_ptr_add
END INTERFACE

and now everything works. Compilers are the current Intel ones:

Intel(R) Fortran Compiler for applications running on Intel(R) 64,
Version 10.1 Build 20080212 Package ID: l_fc_p_10.1.013

Intel(R) C Compiler for applications running on Intel(R) 64, Version
10.1 Build 20080212 Package ID: l_cc_p_10.1.013

The machines are our Itanium systems (IA64 cluster with GE and an Altix
3700) as well as our Opteron cluster.

Is this a compiler bug or have I gotten something wrong?


Sebastian
.



Relevant Pages

  • Re: intent(in)
    ... > in program/module or the interface block if I have gotten ... Explicit is when you supply the information to the compiler. ... case of a variable type, you have a type declaration statement; ... Implicit is when the compiler deduces the information implicitly. ...
    (comp.lang.fortran)
  • Re: Getting object properties from interface reference
    ... but you will not be able to early bind your ... method calls because, as you are aware, the compiler only sees the interface ... > public class GraphClass: IGraphInterface ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: implicit cast operator funny-ness
    ... The compiler does not know when of the million possible implicit ... specific interface you are thinking of, ... so assigning A to an IB will cause who knows what, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: MFC and c++ problems
    ... compiler to generate code that is architecturally nonsensical. ... So a design in which a control has any syntactic knowledge of any container of itself ... GetParent->SendMessage is the interface of choice, ...
    (microsoft.public.vc.mfc)
  • Re: module
    ... implicit none ... !gcc$ ATTRIBUTES STDCALL:: GetLastError ... realsimpson ...
    (comp.lang.fortran)