public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* C_LOC and character arrays
@ 2017-03-30 15:21 John McFarland
  0 siblings, 0 replies; only message in thread
From: John McFarland @ 2017-03-30 15:21 UTC (permalink / raw)
  To: fortran

Hello,

The following code compiles for me with gfortran 6.3.0_1, but it does
not seem to conform to (my understanding of) the standard that C_LOC
cannot be used on character types with length > 1.  Maybe I am missing
something, or should this code be flagged as an error?

See also bug 36759: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36759

PROGRAM main
  USE, INTRINSIC :: ISO_C_BINDING
  IMPLICIT NONE
  CHARACTER(len=2), TARGET :: strings(2)
  TYPE (C_PTR) :: p
  strings(1) = '12'
  p = C_LOC(strings(1))
END PROGRAM main

Thanks,
John

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-03-30 15:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-30 15:21 C_LOC and character arrays John McFarland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).