public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "anlauf at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/102368] Failure to compile program using the C_SIZEOF function in ISO_C_BINDING
Date: Sat, 13 Nov 2021 21:15:14 +0000	[thread overview]
Message-ID: <bug-102368-4-gdw5hAJeaW@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102368-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102368

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |WAITING

--- Comment #5 from anlauf at gcc dot gnu.org ---
The relevant F2018 standard excerpts are:

18.2.3.7  C_SIZEOF (X)
[...]
Argument. X shall be an interoperable data entity ...

3.45  data entity
data object, result of the evaluation of an expression, or the result of
the execution of a function reference

3.46  data object
constant (7.1.4), variable (9), or subobject of a constant (5.4.3.2.4)

3.92  interoperable
⟨Fortran entity⟩ equivalent to an entity defined by or definable by the
companion processor (18.3)

18.3.1  Interoperability of intrinsic types

Table 18.2 shows the interoperability between Fortran intrinsic types and C
types.  A Fortran intrinsic type with particular type parameter values is
interoperable with a C type if the type and kind type parameter value are
listed in the table on the same row as that C type.  If the type is
character, the length type parameter is interoperable if and only if its
value is one. ...

18.3.4  Interoperability of scalar variables

A named scalar Fortran variable is interoperable if and only if its type
and type parameters are interoperable, [...], and if it is of type
character its length is not assumed or declared by an expression that is
not a constant expression.

An interoperable scalar Fortran variable is interoperable with a scalar C
entity if their types and type parameters are interoperable.


I understand Steve's comment that the length has to be constant and one.
If this is the common understanding, the current PR would be invalid.

      parent reply	other threads:[~2021-11-13 21:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-16 14:49 [Bug fortran/102368] New: " longb at cray dot com
2021-11-11 22:21 ` [Bug fortran/102368] " anlauf at gcc dot gnu.org
2021-11-11 22:53 ` anlauf at gcc dot gnu.org
2021-11-12 17:41 ` anlauf at gcc dot gnu.org
2021-11-12 21:36 ` anlauf at gcc dot gnu.org
2021-11-13 21:15 ` anlauf at gcc dot gnu.org [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-102368-4-gdw5hAJeaW@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).