public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <tobias@codesourcery.com>
To: Sandra Loosemore <sandra@codesourcery.com>,
	<gcc-patches@gcc.gnu.org>, <fortran@gcc.gnu.org>
Subject: Re: [PATCH 1/3] [PR libfortran/101305] Bind(C): Fix type encodings in ISO_Fortran_binding.h
Date: Wed, 21 Jul 2021 12:03:42 +0200	[thread overview]
Message-ID: <836eba04-132f-8e1e-fd99-0b0d6058c7f1@codesourcery.com> (raw)
In-Reply-To: <20210713212859.1532449-2-sandra@codesourcery.com>

On 13.07.21 23:28, Sandra Loosemore wrote:

> ISO_Fortran_binding.h had many incorrect hardwired kind encodings in
> the definitions of the CFI_type_* macros.  Additionally, not all
> targets support all the defined type encodings, and the Fortran
> standard requires those macros to have a negative value.
>
> This patch changes ISO_Fortran_binding.h to use sizeof instead of
> hard-coded sizes, and assembles it from fragments that reflect the
> set of types supported by the target.
>
> 2021-07-13  Sandra Loosemore<sandra@codesourcery.com>
>           Tobias Burnus<tobias@codesourcery.com>
>
> libgfortran/
>       PR libfortran/101305
>       * ISO_Fortran_binding.h: Fix hard-coded sizes and split into...
>       * ISO_Fortran_binding-1-tmpl.h: New file.
>       * ISO_Fortran_binding-2-tmpl.h: New file.
>       * ISO_Fortran_binding-3-tmpl.h: New file.
>       * Makefile.am: Add rule for generating ISO_Fortran_binding.h.
>       Adjust pathnames to that file.
>       * Makefile.in: Regenerated.
>       * mk-kinds-h.sh: New file.
>       * runtime/ISO_Fortran_binding.c: Fix include path.
LGTM – except for the following remark regarding a preexisting comment.

> --- /dev/null
> +++ b/libgfortran/ISO_Fortran_binding-1-tmpl.h
> +/* Error codes.
> +   CFI_INVALID_STRIDE should be defined in the standard because they are useful to the implementation of the functions.
> + */

The standard permits: "Error conditions other than those listed in this
subclause should be indicated by error codes different from the values
of the macros named in this subclause."

I personally do not like current (preexisting) the wording in the
comment – and CFI_FAILURE is also not listed, which is also not part
of Fortran standard. I think some wording along the following is
be more appropriate:
"Note that CFI_FAILURE and CFI_INVALID_STRIDE specific to GCC and not
part of the Fortran standard."


> +#define CFI_SUCCESS 0
> +#define CFI_FAILURE 1
> +#define CFI_ERROR_BASE_ADDR_NULL 2
> +#define CFI_ERROR_BASE_ADDR_NOT_NULL 3
> +#define CFI_INVALID_ELEM_LEN 4
> +#define CFI_INVALID_RANK 5
> +#define CFI_INVALID_TYPE 6
> +#define CFI_INVALID_ATTRIBUTE 7
> +#define CFI_INVALID_EXTENT 8
> +#define CFI_INVALID_STRIDE 9
> +#define CFI_INVALID_DESCRIPTOR 10
> +#define CFI_ERROR_MEM_ALLOCATION 11
> +#define CFI_ERROR_OUT_OF_BOUNDS 12

Tobias

-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

  reply	other threads:[~2021-07-21 10:03 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-13 21:28 [PATCH 0/3] [PR libfortran/101305] Bind(C): Fix kind/size mappings Sandra Loosemore
2021-07-13 21:28 ` [PATCH 1/3] [PR libfortran/101305] Bind(C): Fix type encodings in ISO_Fortran_binding.h Sandra Loosemore
2021-07-21 10:03   ` Tobias Burnus [this message]
2021-07-13 21:28 ` [PATCH 2/3] [PR libfortran/101305] Bind(C): Correct sizes of some types in CFI_establish Sandra Loosemore
2021-07-21  9:48   ` Tobias Burnus
2021-07-13 21:28 ` [PATCH 3/3] [PR libfortran/101305] Fix ISO_Fortran_binding.h paths in gfortran testsuite Sandra Loosemore
2021-07-21 10:17   ` Tobias Burnus
2021-07-23 14:15     ` Tobias Burnus
2021-07-23 20:43       ` Sandra Loosemore
2021-07-26  9:45         ` Tobias Burnus
2021-07-26 20:13           ` Sandra Loosemore
2021-07-28  4:36             ` Sandra Loosemore
2021-07-28 11:22               ` [Patch] gfortran.dg/dg.exp: Add libgfortran as -I flag for ISO*.h [PR101305] (was: [PATCH 3/3] [PR libfortran/101305] Fix ISO_Fortran_binding.h paths in gfortran testsuite) Tobias Burnus
2021-07-28 22:56                 ` Jakub Jelinek
2021-07-29  7:09                   ` Jakub Jelinek
2021-07-29  9:51                     ` [Patch] testsuite/lib/gfortran.exp: Add -I for ISO*.h [PR101305, PR101660] (was: Re: [Patch] gfortran.dg/dg.exp: Add libgfortran as -I flag for ISO*.h [PR101305] (was: [PATCH 3/3] [PR libfortran/101305] Fix ISO_Fortran_binding.h paths in gfortran testsuite)) Tobias Burnus
2021-08-09 10:50                       ` committed – " Tobias Burnus
2021-08-04  9:00   ` [PATCH 3/3] [PR libfortran/101305] Fix ISO_Fortran_binding.h paths in gfortran testsuite Andreas Schwab
2021-08-09 10:52     ` Tobias Burnus

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=836eba04-132f-8e1e-fd99-0b0d6058c7f1@codesourcery.com \
    --to=tobias@codesourcery.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=sandra@codesourcery.com \
    /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).