public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, Fortran] set version field in CFI_cdesc_t to CFI_VERSION
@ 2021-07-01  6:00 Sandra Loosemore
  2021-07-01  7:26 ` Tobias Burnus
  0 siblings, 1 reply; 2+ messages in thread
From: Sandra Loosemore @ 2021-07-01  6:00 UTC (permalink / raw)
  To: gcc-patches, fortran, Tobias Burnus

[-- Attachment #1: Type: text/plain, Size: 549 bytes --]

This patch fixes the failures in interoperability/fc-descriptor-8.f90 in 
my just-posted TS 29113 testsuite:

https://gcc.gnu.org/pipermail/gcc-patches/2021-July/574115.html

The problem here is that the routines that copy between GFC and CFI 
descriptors think they both use the same version number conventions, but 
the GFC descriptors' version is zero-initialized elsewhere and 
CFI_VERSION is defined to be 1.  It seems incorrect to expect the 
internal and external descriptor ABIs to be in lock step together anyway.

OK to check in?

-Sandra

[-- Attachment #2: cfi-version.patch --]
[-- Type: text/x-patch, Size: 1701 bytes --]

commit b0edc2d3287d6ed52a43010b92c4158c6208ef11
Author: Sandra Loosemore <sandra@codesourcery.com>
Date:   Wed Jun 30 19:28:22 2021 -0700

    Fortran: set version field in CFI_cdesc_t to CFI_VERSION
    
    When converting a GFC descriptor to a CFI descriptor, it was
    incorrectly copying the version number from the former to the latter.
    It should be using the value of CFI_VERSION instead (currently 1).
    Going the other direction, the GFC version field is initialized to
    zero elsewhere, so do that here too.
    
    2021-06-30  Tobias Burnus  <tobias@codesourcery.com>
    	    Sandra Loosemore  <sandra@codesourcery.com>
    
    	libgfortran/
    	* runtime/ISO_Fortran_binding.c (cfi_desc_to_gfc_desc):
    	Initialize version field to 0.
    	(gfc_desc_to_cfi_desc): Initialize version field to CFI_VERSION.

diff --git a/libgfortran/runtime/ISO_Fortran_binding.c b/libgfortran/runtime/ISO_Fortran_binding.c
index 0978832..73fb4c4 100644
--- a/libgfortran/runtime/ISO_Fortran_binding.c
+++ b/libgfortran/runtime/ISO_Fortran_binding.c
@@ -60,7 +60,7 @@ cfi_desc_to_gfc_desc (gfc_array_void *d, CFI_cdesc_t **s_ptr)
   else
     GFC_DESCRIPTOR_SIZE (d) = s->elem_len;
 
-  d->dtype.version = s->version;
+  d->dtype.version = 0;
   GFC_DESCRIPTOR_RANK (d) = (signed char)s->rank;
 
   d->dtype.attribute = (signed short)s->attribute;
@@ -104,7 +104,7 @@ gfc_desc_to_cfi_desc (CFI_cdesc_t **d_ptr, const gfc_array_void *s)
 
   d->base_addr = GFC_DESCRIPTOR_DATA (s);
   d->elem_len = GFC_DESCRIPTOR_SIZE (s);
-  d->version = s->dtype.version;
+  d->version = CFI_VERSION;
   d->rank = (CFI_rank_t)GFC_DESCRIPTOR_RANK (s);
   d->attribute = (CFI_attribute_t)s->dtype.attribute;
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH, Fortran] set version field in CFI_cdesc_t to CFI_VERSION
  2021-07-01  6:00 [PATCH, Fortran] set version field in CFI_cdesc_t to CFI_VERSION Sandra Loosemore
@ 2021-07-01  7:26 ` Tobias Burnus
  0 siblings, 0 replies; 2+ messages in thread
From: Tobias Burnus @ 2021-07-01  7:26 UTC (permalink / raw)
  To: Sandra Loosemore, gcc-patches, fortran

On 01.07.21 08:00, Sandra Loosemore wrote:
> This patch fixes the failures in interoperability/fc-descriptor-8.f90
> in my just-posted TS 29113 testsuite:
> https://gcc.gnu.org/pipermail/gcc-patches/2021-July/574115.html
>
> The problem here is that the routines that copy between GFC and CFI
> descriptors think they both use the same version number conventions,
> but the GFC descriptors' version is zero-initialized elsewhere and
> CFI_VERSION is defined to be 1.  It seems incorrect to expect the
> internal and external descriptor ABIs to be in lock step together anyway.
>
> OK to check in?


OK – and thanks for the patch!

I note that the FE does not explicitly set the version but it inits the
descriptor such that it happens that value the version field is
'\0'-fied; additionally, neither libgfortran nor the FE ever access the
version field.

Tobias

-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-01  7:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-01  6:00 [PATCH, Fortran] set version field in CFI_cdesc_t to CFI_VERSION Sandra Loosemore
2021-07-01  7:26 ` Tobias Burnus

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).