public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <tobias@codesourcery.com>
To: "José Rui Faustino de Sousa" <jrfsousa@gmail.com>,
	fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: [Patch, fortran V2] PR fortran/93308/93963/94327/94331/97046 problems raised by descriptor handling
Date: Mon, 21 Jun 2021 15:46:29 +0200	[thread overview]
Message-ID: <f30f45a2-5889-38d7-7199-3451c87d5bf4@codesourcery.com> (raw)
In-Reply-To: <0b4b1feb-aa45-31ab-9185-546bd0cc551a@gmail.com>

Hi José,

(in principle, I'd like to have the libgfortran function moved to the
compiler proper to avoid some issues, but that's admittedly a task
independent of your work.)

On 15.06.21 01:09, José Rui Faustino de Sousa via Fortran wrote:
> Update to a proposed patch to:
> Bug 93308 - bind(c) subroutine changes lower bound of array argument
> in caller
> Bug 93963 - Select rank mishandling allocatable and pointer arguments
> with bind(c)
> Bug 94327 - Bind(c) argument attributes are incorrectly set
> Bug 94331 - Bind(C) corrupts array descriptors
> Bug 97046 - Bad interaction between lbound/ubound, allocatable arrays
> and bind(C) subroutine with dimension(..) parameter
> ...
> Patch tested only on x86_64-pc-linux-gnu.
> Fix attribute handling, which reflect a prior intermediate version of
> the Fortran standard.

LGTM – except for one minor nit. In trans-expr.c's gfc_conv_gfc_desc_to_cfi_desc:

    /* Transfer values back to gfc descriptor.  */
+  if (cfi_attribute != 2
+      && !fsym->attr.value
+      && fsym->attr.intent != INTENT_IN)

Can you add after the '2' the string '  /* CFI_attribute_other.  */'
to make the number less magic.

Thanks,

Tobias


>
> CFI descriptors, in most cases, should not be copied out has they can
> corrupt the Fortran descriptor. Bounds will vary and the original
> Fortran bounds are definitively lost on conversion.
>
> Thank you very much.
>
> Best regards,
> José Rui
>
> Fortran: Fix attributtes and bounds in ISO_Fortran_binding.
>
> gcc/fortran/ChangeLog:
>
>     PR fortran/93308
>     PR fortran/93963
>     PR fortran/94327
>     PR fortran/94331
>     PR fortran/97046
>     * trans-decl.c (convert_CFI_desc): Only copy out the descriptor
>     if necessary.
>     * trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): Updated attribute
>     handling which reflect a previous intermediate version of the
>     standard. Only copy out the descriptor if necessary.
>
> libgfortran/ChangeLog:
>
>     PR fortran/93308
>     PR fortran/93963
>     PR fortran/94327
>     PR fortran/94331
>     PR fortran/97046
>     * runtime/ISO_Fortran_binding.c (cfi_desc_to_gfc_desc): Add code
>     to verify the descriptor. Correct bounds calculation.
>     (gfc_desc_to_cfi_desc): Add code to verify the descriptor.
>
> gcc/testsuite/ChangeLog:
>
>     PR fortran/93308
>     PR fortran/93963
>     PR fortran/94327
>     PR fortran/94331
>     PR fortran/97046
>     * gfortran.dg/ISO_Fortran_binding_1.f90: Add pointer attribute,
>     this test is still erroneous but now it compiles.
>     * gfortran.dg/bind_c_array_params_2.f90: Update regex to match
>     code changes.
>     * gfortran.dg/PR93308.f90: New test.
>     * gfortran.dg/PR93963.f90: New test.
>     * gfortran.dg/PR94327.c: New test.
>     * gfortran.dg/PR94327.f90: New test.
>     * gfortran.dg/PR94331.c: New test.
>     * gfortran.dg/PR94331.f90: New test.
>     * gfortran.dg/PR97046.f90: New test.
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf

  reply	other threads:[~2021-06-21 13:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-14 23:09 José Rui Faustino de Sousa
2021-06-21 13:46 ` Tobias Burnus [this message]
2021-06-21 15:51   ` José Rui Faustino de Sousa
2021-06-21 16:46     ` Tobias Burnus
2021-06-21 17:52       ` José Rui Faustino de Sousa
2021-06-21 20:29         ` Tobias Burnus
2021-06-22  7:11           ` Tobias Burnus
2021-07-26 12:43             ` Committed: " Tobias Burnus
  -- strict thread matches above, loose matches on Subject: below --
2021-06-03 15:04 [Patch, fortran] PR fortran/100120/100816/100818/100819/100821 problems raised by aggregate data types dhumieres.dominique
2021-06-04 15:24 ` Paul Richard Thomas
2021-06-05 12:40   ` dhumieres.dominique
2021-06-06 17:58     ` Re:[Patch, fortran] PR fortran/93308/93963/94327/94331/97046 problems raised by descriptor handling dhumieres.dominique
2021-06-19 10:57       ` [Patch, fortran v2] " dhumieres.dominique

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=f30f45a2-5889-38d7-7199-3451c87d5bf4@codesourcery.com \
    --to=tobias@codesourcery.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jrfsousa@gmail.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).