[Bug fortran/93308] bind(c) subroutine changes lower bound of array argument in caller

2021-05-12 Thread sandra at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93308

sandra at gcc dot gnu.org changed:

   What|Removed |Added

 CC||sandra at gcc dot gnu.org

--- Comment #2 from sandra at gcc dot gnu.org ---
This bug also affects pointer arrays passed as an argument corresponding to a
non-pointer assumed-shape dummy.  It's also independent of whether the called
bind(c) function is implemented in Fortran or C.

PR94331 is at least a partial duplicate of this bug.

[Bug fortran/93308] bind(c) subroutine changes lower bound of array argument in caller

2021-05-14 Thread jrfsousa at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93308

José Rui Faustino de Sousa  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |jrfsousa at gcc dot 
gnu.org
 CC||jrfsousa at gcc dot gnu.org

--- Comment #3 from José Rui Faustino de Sousa  ---
Hi Sandra!

Hi I have a patch for this, which also seems to work for PR93 I expect to post
it in the next week, if all goes well.

Best regards,
José Rui

[Bug fortran/93308] bind(c) subroutine changes lower bound of array argument in caller

2021-05-19 Thread jrfsousa at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93308

--- Comment #4 from José Rui Faustino de Sousa  ---
Patch posted:

https://gcc.gnu.org/pipermail/fortran/2021-May/056054.html

[Bug fortran/93308] bind(c) subroutine changes lower bound of array argument in caller

2020-01-19 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93308

Thomas Koenig  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2020-01-20
 CC||pault at gcc dot gnu.org,
   ||tkoenig at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Thomas Koenig  ---
Confirmed.

[Bug fortran/93308] bind(c) subroutine changes lower bound of array argument in caller

2021-05-30 Thread dominiq at lps dot ens.fr via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93308

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

--- Comment #5 from Dominique d'Humieres  ---
> Patch posted:
>
> https://gcc.gnu.org/pipermail/fortran/2021-May/056054.html


The patch fixes this PR, see also pr94331.

[Bug fortran/93308] bind(c) subroutine changes lower bound of array argument in caller

2021-06-14 Thread jrfsousa at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93308

--- Comment #6 from José Rui Faustino de Sousa  ---
Updated patch:

https://gcc.gnu.org/pipermail/fortran/2021-June/056163.html

[Bug fortran/93308] bind(c) subroutine changes lower bound of array argument in caller

2021-06-14 Thread jrfsousa at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93308

--- Comment #7 from José Rui Faustino de Sousa  ---
Created attachment 51014
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51014&action=edit
Updated patch.

[Bug fortran/93308] bind(c) subroutine changes lower bound of array argument in caller

2021-07-01 Thread sandra at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93308

--- Comment #8 from sandra at gcc dot gnu.org ---
I tested the second version of the patch; it does fix the bug I observed with
an assumed-rank array argument in a Fortran subroutine with C binding called
from C having lower bound 0 instead of 1.

This is interoperability/cf-descriptor-2.f90 in the new TS29113 testsuite.

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

I think the patch was approved modulo some small cleanup; can we get it
committed soon so I can cross it off the list of test failures I'm tracking?

[Bug fortran/93308] bind(c) subroutine changes lower bound of array argument in caller

2021-07-26 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93308

--- Comment #9 from CVS Commits  ---
The master branch has been updated by Tobias Burnus :

https://gcc.gnu.org/g:0cbf03689e3e7d9d6002b8e5d159ef3716d0404c

commit r12-2511-g0cbf03689e3e7d9d6002b8e5d159ef3716d0404c
Author: Tobias Burnus 
Date:   Mon Jul 26 14:20:46 2021 +0200

PR fortran/93308/93963/94327/94331/97046 problems raised by descriptor
handling

Fortran: Fix attributes and bounds in ISO_Fortran_binding.

2021-07-26  José Rui Faustino de Sousa  
Tobias Burnus  

PR fortran/93308
PR fortran/93963
PR fortran/94327
PR fortran/94331
PR fortran/97046

gcc/fortran/ChangeLog:

* 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:

* 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:

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

[Bug fortran/93308] bind(c) subroutine changes lower bound of array argument in caller

2021-07-28 Thread sandra at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93308

sandra at gcc dot gnu.org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #10 from sandra at gcc dot gnu.org ---
I've confirmed the committed patch fixes the bug I ran into.  I'm marking this
issue fixed.