[J3] BLOCK DATA and BIND(C) question

Bader, Reinhold Reinhold.Bader at lrz.de
Tue Feb 1 21:29:22 UTC 2022


Yes. The constraints are crafted such that only globals can be referred to in a BIND(C) statement. And in the context of a BLOCK DATA, this boils down to a COMMON block.
________________________________________
Von: Steven G. Kargl <kargl at uw.edu>
Gesendet: Dienstag, 1. Februar 2022 21:49:45
An: General J3 interest list
Cc: Bader, Reinhold
Betreff: Re: [J3] BLOCK DATA and BIND(C) question

Thanks for the reply.  I suppose that I'm misreading
C1415.  Restricting it to BIND.  I read this as

C1415  (R1420) A block-data specification-part shall contain
       BIND statements.

The first example has only a BIND(C) statement in the specification-part.
But, I suppose C819 applies and 'A' cannot be a variable.  So, it is
invalid code.  If I then look at C818, which permits a common block,
then the BIND statement in C1415 would apply to the following:

block data
   common /a/x
   bind(c) :: /a/
end block data

--
steve


On Tue, Feb 01, 2022 at 08:17:01PM +0000, Bader, Reinhold via J3 wrote:
> Steve,
>
> an entity referenced by a BIND statement in a BLOCK DATA program unit must
> be a common block.
> Hence, all three examples you give are non-conforming.
>
> I think this also implies that the cited constraints are not internally
> contradictory.
>
> Cheers
> Reinhold
>
> > -----Ursprüngliche Nachricht-----
> > Von: J3 <j3-bounces at mailman.j3-fortran.org> Im Auftrag von Steven G.
> > Kargl via J3
> > Gesendet: Dienstag, 1. Februar 2022 20:08
> > An: J3 Fortran <j3 at mailman.j3-fortran.org>
> > Cc: Steven G. Kargl <kargl at uw.edu>
> > Betreff: [J3] BLOCK DATA and BIND(C) question
> >
> > Are these code snippets equivalent?
> >
> > BLOCK DATA
> >    BIND(C) :: A
> > END BLOCK DATA
> >
> > BLOCK DATA
> >    REAL :: A
> >    BIND(C) :: A
> > END BLOCK DATA
> >
> > BLOCK DATA
> >    REAL, BIND(C) :: A
> > END BLOCK DATA
> >
> >
> > If yes, do C1415 and C1416 conflict?
> >
> > C1415 (R1420) A block-data specification-part shall contain
> >       only derived-type definitions and ..., BIND, ..., and
> >       type declaration statements.
> >
> > C1416 (R1420) A type declaration statement in a block-data
> >       specification-part shall not contain ALLOCATABLE, EXTERNAL,
> >       or BIND attribute specifiers.
> >
> > In fact, does C1415 conflict with C819?
> >
> > C819 A variable with the BIND attribute shall be declared in
> >      the specification part of a module.
> >
> > --
> > Steve



--
Steve


More information about the J3 mailing list