diff mbox series

[fortran] A first small step towards CFI descriptor implementation

Message ID CAGkQGiJcaLdFfVkGbOonPaBAWoMr_Q=sLEVs17fGbwwamBaL5A@mail.gmail.com
State New
Headers show
Series [fortran] A first small step towards CFI descriptor implementation | expand

Commit Message

Paul Richard Thomas July 31, 2018, 12:06 p.m. UTC
Daniel Celis Garza and Damian Rouson have developed a runtime library
and include file for the TS 29113 and F2018 C descriptors.
https://github.com/sourceryinstitute/ISO_Fortran_binding

The ordering of types is different to the current 'bt' enum in
libgfortran.h. This patch interchanges BT_DERIVED and BT_CHARACTER to
fix this.

Regtests on FC28/x86_64. OK for trunk?

Cheers

Paul

2018-07-31  Paul Thomas  <pault@gcc.gnu.org>

    * gcc/fortran/libgfortran.h : In bt enum interchange BT_DERIVED
    and BT_CHARACTER for CFI descriptor compatibility(TS 29113).

Comments

Richard Biener July 31, 2018, 2:57 p.m. UTC | #1
On Tue, Jul 31, 2018 at 2:07 PM Paul Richard Thomas
<paul.richard.thomas@gmail.com> wrote:
>
> Daniel Celis Garza and Damian Rouson have developed a runtime library
> and include file for the TS 29113 and F2018 C descriptors.
> https://github.com/sourceryinstitute/ISO_Fortran_binding
>
> The ordering of types is different to the current 'bt' enum in
> libgfortran.h. This patch interchanges BT_DERIVED and BT_CHARACTER to
> fix this.
>
> Regtests on FC28/x86_64. OK for trunk?

That's an ABI change, correct?

Richard.

> Cheers
>
> Paul
>
> 2018-07-31  Paul Thomas  <pault@gcc.gnu.org>
>
>     * gcc/fortran/libgfortran.h : In bt enum interchange BT_DERIVED
>     and BT_CHARACTER for CFI descriptor compatibility(TS 29113).
Paul Richard Thomas July 31, 2018, 3:13 p.m. UTC | #2
Hi Richard,

Ah yes, you are absolutely right. I will sit on it for a bit and do
the interchange at the descriptor conversion stage for now.

Thanks

Paul
On Tue, 31 Jul 2018 at 15:57, Richard Biener <richard.guenther@gmail.com> wrote:
>
> On Tue, Jul 31, 2018 at 2:07 PM Paul Richard Thomas
> <paul.richard.thomas@gmail.com> wrote:
> >
> > Daniel Celis Garza and Damian Rouson have developed a runtime library
> > and include file for the TS 29113 and F2018 C descriptors.
> > https://github.com/sourceryinstitute/ISO_Fortran_binding
> >
> > The ordering of types is different to the current 'bt' enum in
> > libgfortran.h. This patch interchanges BT_DERIVED and BT_CHARACTER to
> > fix this.
> >
> > Regtests on FC28/x86_64. OK for trunk?
>
> That's an ABI change, correct?
>
> Richard.
>
> > Cheers
> >
> > Paul
> >
> > 2018-07-31  Paul Thomas  <pault@gcc.gnu.org>
> >
> >     * gcc/fortran/libgfortran.h : In bt enum interchange BT_DERIVED
> >     and BT_CHARACTER for CFI descriptor compatibility(TS 29113).
Janus Weil July 31, 2018, 5:10 p.m. UTC | #3
Hi Paul,

2018-07-31 14:06 GMT+02:00 Paul Richard Thomas <paul.richard.thomas@gmail.com>:
> Daniel Celis Garza and Damian Rouson have developed a runtime library
> and include file for the TS 29113 and F2018 C descriptors.
> https://github.com/sourceryinstitute/ISO_Fortran_binding
>
> The ordering of types is different to the current 'bt' enum in
> libgfortran.h. This patch interchanges BT_DERIVED and BT_CHARACTER to
> fix this.

is this ordering actually fixed by the F18 standard, or is there any
other reason why it needs to be like this? What's wrong with
gfortran's current ordering?

Cheers,
Janus
Paul Richard Thomas Aug. 2, 2018, 9:04 a.m. UTC | #4
The ordering is fixed by the ordering of types in the CFI part of the
standard. Intrinsic types, then derived types and finally all the
others.

For the time being I will interchange character and derived types in
the conversion functions.

Cheers

Paul
On Tue, 31 Jul 2018 at 18:10, Janus Weil <janus@gcc.gnu.org> wrote:
>
> Hi Paul,
>
> 2018-07-31 14:06 GMT+02:00 Paul Richard Thomas <paul.richard.thomas@gmail.com>:
> > Daniel Celis Garza and Damian Rouson have developed a runtime library
> > and include file for the TS 29113 and F2018 C descriptors.
> > https://github.com/sourceryinstitute/ISO_Fortran_binding
> >
> > The ordering of types is different to the current 'bt' enum in
> > libgfortran.h. This patch interchanges BT_DERIVED and BT_CHARACTER to
> > fix this.
>
> is this ordering actually fixed by the F18 standard, or is there any
> other reason why it needs to be like this? What's wrong with
> gfortran's current ordering?
>
> Cheers,
> Janus
diff mbox series

Patch

Index: gcc/fortran/libgfortran.h
===================================================================
*** gcc/fortran/libgfortran.h	(revision 262444)
--- gcc/fortran/libgfortran.h	(working copy)
*************** typedef enum
*** 171,177 ****
     used in the run-time library for IO.  */
  typedef enum
  { BT_UNKNOWN = 0, BT_INTEGER, BT_LOGICAL, BT_REAL, BT_COMPLEX,
!   BT_DERIVED, BT_CHARACTER, BT_CLASS, BT_PROCEDURE, BT_HOLLERITH, BT_VOID,
    BT_ASSUMED, BT_UNION
  }
  bt;
--- 171,177 ----
     used in the run-time library for IO.  */
  typedef enum
  { BT_UNKNOWN = 0, BT_INTEGER, BT_LOGICAL, BT_REAL, BT_COMPLEX,
!   BT_CHARACTER, BT_DERIVED, BT_CLASS, BT_PROCEDURE, BT_HOLLERITH, BT_VOID,
    BT_ASSUMED, BT_UNION
  }
  bt;