public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/99982] New: INTERFACE selects wrong module procedure involving C_PTR and C_FUNPTR
@ 2021-04-09  3:02 brtnfld at hdfgroup dot org
  2021-04-21  4:53 ` [Bug fortran/99982] " brtnfld at hdfgroup dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: brtnfld at hdfgroup dot org @ 2021-04-09  3:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99982

            Bug ID: 99982
           Summary: INTERFACE selects wrong module procedure involving
                    C_PTR and C_FUNPTR
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: brtnfld at hdfgroup dot org
  Target Milestone: ---

Created attachment 50532
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50532&action=edit
program uses interface and module procedure to select between subroutines with
type C_PTR and C_FUNPTR

The attached program always selects the TYPE(C_FUNPTR) when selecting between a
(overloaded) subroutine with TYPE(C_PTR) and TYPE(C_FUNPTR), even when the
variable type is TYPE(C_PTR).

It does this for both passing a variable as the argument or using the C_LOC or
c_funloc directly in the call.

I tried it with 7.5.0, 10.2.0, same behavior.
Intel and NAG both select the correct subroutine.

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

* [Bug fortran/99982] INTERFACE selects wrong module procedure involving C_PTR and C_FUNPTR
  2021-04-09  3:02 [Bug fortran/99982] New: INTERFACE selects wrong module procedure involving C_PTR and C_FUNPTR brtnfld at hdfgroup dot org
@ 2021-04-21  4:53 ` brtnfld at hdfgroup dot org
  2022-04-20 16:24 ` thierry at FreeBSD dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: brtnfld at hdfgroup dot org @ 2021-04-21  4:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99982

--- Comment #1 from Scot Breitenfeld <brtnfld at hdfgroup dot org> ---
I checked with gcc master (4/20/2021), and it still has the same issue.

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

* [Bug fortran/99982] INTERFACE selects wrong module procedure involving C_PTR and C_FUNPTR
  2021-04-09  3:02 [Bug fortran/99982] New: INTERFACE selects wrong module procedure involving C_PTR and C_FUNPTR brtnfld at hdfgroup dot org
  2021-04-21  4:53 ` [Bug fortran/99982] " brtnfld at hdfgroup dot org
@ 2022-04-20 16:24 ` thierry at FreeBSD dot org
  2022-04-20 19:19 ` anlauf at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: thierry at FreeBSD dot org @ 2022-04-20 16:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99982

--- Comment #2 from Thierry Thomas <thierry at FreeBSD dot org> ---
I noticed the problem when building CGNS with gfortran / Gcc 10.2.0, and now
with Gcc 10.3.2 the issue disappeared.

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

* [Bug fortran/99982] INTERFACE selects wrong module procedure involving C_PTR and C_FUNPTR
  2021-04-09  3:02 [Bug fortran/99982] New: INTERFACE selects wrong module procedure involving C_PTR and C_FUNPTR brtnfld at hdfgroup dot org
  2021-04-21  4:53 ` [Bug fortran/99982] " brtnfld at hdfgroup dot org
  2022-04-20 16:24 ` thierry at FreeBSD dot org
@ 2022-04-20 19:19 ` anlauf at gcc dot gnu.org
  2023-03-22 16:41 ` brtnfld at hdfgroup dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-04-20 19:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99982

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-04-20
     Ever confirmed|0                           |1

--- Comment #3 from anlauf at gcc dot gnu.org ---
(In reply to Thierry Thomas from comment #2)
> I noticed the problem when building CGNS with gfortran / Gcc 10.2.0, and now
> with Gcc 10.3.2 the issue disappeared.

No.  The reported problem still exists.  Output for the attached testcase:

 cg_configure_funptr
 cg_configure_funptr
 cg_configure_funptr
 cg_configure_funptr

Expected:

 cg_configure_ptr
 cg_configure_funptr
 cg_configure_ptr
 cg_configure_funptr

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

* [Bug fortran/99982] INTERFACE selects wrong module procedure involving C_PTR and C_FUNPTR
  2021-04-09  3:02 [Bug fortran/99982] New: INTERFACE selects wrong module procedure involving C_PTR and C_FUNPTR brtnfld at hdfgroup dot org
                   ` (2 preceding siblings ...)
  2022-04-20 19:19 ` anlauf at gcc dot gnu.org
@ 2023-03-22 16:41 ` brtnfld at hdfgroup dot org
  2023-03-22 17:08 ` brtnfld at hdfgroup dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: brtnfld at hdfgroup dot org @ 2023-03-22 16:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99982

--- Comment #4 from Scot Breitenfeld <brtnfld at hdfgroup dot org> ---
Is there an update on this issue, the CGNS fortran wrappers will not work with
gfortran as there are no work arounds for this issue.

Thanks.

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

* [Bug fortran/99982] INTERFACE selects wrong module procedure involving C_PTR and C_FUNPTR
  2021-04-09  3:02 [Bug fortran/99982] New: INTERFACE selects wrong module procedure involving C_PTR and C_FUNPTR brtnfld at hdfgroup dot org
                   ` (3 preceding siblings ...)
  2023-03-22 16:41 ` brtnfld at hdfgroup dot org
@ 2023-03-22 17:08 ` brtnfld at hdfgroup dot org
  2023-04-11 14:56 ` anlauf at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: brtnfld at hdfgroup dot org @ 2023-03-22 17:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99982

--- Comment #5 from Scot Breitenfeld <brtnfld at hdfgroup dot org> ---
I removed the c_funptr interface in CGNS since it was not being used.

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

* [Bug fortran/99982] INTERFACE selects wrong module procedure involving C_PTR and C_FUNPTR
  2021-04-09  3:02 [Bug fortran/99982] New: INTERFACE selects wrong module procedure involving C_PTR and C_FUNPTR brtnfld at hdfgroup dot org
                   ` (4 preceding siblings ...)
  2023-03-22 17:08 ` brtnfld at hdfgroup dot org
@ 2023-04-11 14:56 ` anlauf at gcc dot gnu.org
  2023-04-12  9:14 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-04-11 14:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99982

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |anlauf at gcc dot gnu.org
                 CC|                            |anlauf at gcc dot gnu.org
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=61615
             Status|NEW                         |ASSIGNED

--- Comment #6 from anlauf at gcc dot gnu.org ---
Patch: https://gcc.gnu.org/pipermail/fortran/2023-April/059166.html

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

* [Bug fortran/99982] INTERFACE selects wrong module procedure involving C_PTR and C_FUNPTR
  2021-04-09  3:02 [Bug fortran/99982] New: INTERFACE selects wrong module procedure involving C_PTR and C_FUNPTR brtnfld at hdfgroup dot org
                   ` (5 preceding siblings ...)
  2023-04-11 14:56 ` anlauf at gcc dot gnu.org
@ 2023-04-12  9:14 ` cvs-commit at gcc dot gnu.org
  2023-04-12  9:21 ` anlauf at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-12  9:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99982

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:c482995cc5bac4a2168ea0049041e712544e474b

commit r13-7145-gc482995cc5bac4a2168ea0049041e712544e474b
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Tue Apr 11 16:44:32 2023 +0200

    Fortran: resolve correct generic with TYPE(C_PTR) arguments
[PR61615,PR99982]

    gcc/fortran/ChangeLog:

            PR fortran/61615
            PR fortran/99982
            * interface.cc (compare_parameter): Enable type and rank checks for
            arguments of derived type from the intrinsic module ISO_C_BINDING.

    gcc/testsuite/ChangeLog:

            PR fortran/61615
            PR fortran/99982
            * gfortran.dg/interface_49.f90: New test.

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

* [Bug fortran/99982] INTERFACE selects wrong module procedure involving C_PTR and C_FUNPTR
  2021-04-09  3:02 [Bug fortran/99982] New: INTERFACE selects wrong module procedure involving C_PTR and C_FUNPTR brtnfld at hdfgroup dot org
                   ` (6 preceding siblings ...)
  2023-04-12  9:14 ` cvs-commit at gcc dot gnu.org
@ 2023-04-12  9:21 ` anlauf at gcc dot gnu.org
  2023-04-12 13:56 ` brtnfld at hdfgroup dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-04-12  9:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99982

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
   Target Milestone|---                         |13.0
         Resolution|---                         |FIXED

--- Comment #8 from anlauf at gcc dot gnu.org ---
Fixed on mainline for gcc-13.

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

* [Bug fortran/99982] INTERFACE selects wrong module procedure involving C_PTR and C_FUNPTR
  2021-04-09  3:02 [Bug fortran/99982] New: INTERFACE selects wrong module procedure involving C_PTR and C_FUNPTR brtnfld at hdfgroup dot org
                   ` (7 preceding siblings ...)
  2023-04-12  9:21 ` anlauf at gcc dot gnu.org
@ 2023-04-12 13:56 ` brtnfld at hdfgroup dot org
  2023-04-23 18:53 ` cvs-commit at gcc dot gnu.org
  2023-05-16 13:25 ` brtnfld at hdfgroup dot org
  10 siblings, 0 replies; 12+ messages in thread
From: brtnfld at hdfgroup dot org @ 2023-04-12 13:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99982

--- Comment #9 from Scot Breitenfeld <brtnfld at hdfgroup dot org> ---
This is Great! Thank-you.

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

* [Bug fortran/99982] INTERFACE selects wrong module procedure involving C_PTR and C_FUNPTR
  2021-04-09  3:02 [Bug fortran/99982] New: INTERFACE selects wrong module procedure involving C_PTR and C_FUNPTR brtnfld at hdfgroup dot org
                   ` (8 preceding siblings ...)
  2023-04-12 13:56 ` brtnfld at hdfgroup dot org
@ 2023-04-23 18:53 ` cvs-commit at gcc dot gnu.org
  2023-05-16 13:25 ` brtnfld at hdfgroup dot org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-23 18:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99982

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:62a4f2fb356cab8cfebfeeac2895b657c32b8dd4

commit r12-9467-g62a4f2fb356cab8cfebfeeac2895b657c32b8dd4
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Tue Apr 11 16:44:32 2023 +0200

    Fortran: resolve correct generic with TYPE(C_PTR) arguments
[PR61615,PR99982]

    gcc/fortran/ChangeLog:

            PR fortran/61615
            PR fortran/99982
            * interface.cc (compare_parameter): Enable type and rank checks for
            arguments of derived type from the intrinsic module ISO_C_BINDING.

    gcc/testsuite/ChangeLog:

            PR fortran/61615
            PR fortran/99982
            * gfortran.dg/interface_49.f90: New test.

    (cherry picked from commit c482995cc5bac4a2168ea0049041e712544e474b)

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

* [Bug fortran/99982] INTERFACE selects wrong module procedure involving C_PTR and C_FUNPTR
  2021-04-09  3:02 [Bug fortran/99982] New: INTERFACE selects wrong module procedure involving C_PTR and C_FUNPTR brtnfld at hdfgroup dot org
                   ` (9 preceding siblings ...)
  2023-04-23 18:53 ` cvs-commit at gcc dot gnu.org
@ 2023-05-16 13:25 ` brtnfld at hdfgroup dot org
  10 siblings, 0 replies; 12+ messages in thread
From: brtnfld at hdfgroup dot org @ 2023-05-16 13:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99982

--- Comment #11 from Scot Breitenfeld <brtnfld at hdfgroup dot org> ---
Thanks for the standard reference. That is indeed what I was looking for. I
understand now that, in this case, the INTENT refers to whether C_PTR can be
changed and does not relate to the INTENT state of the target. I should change
all my usage cases to INTENT(IN) since none of the Fortran wrappers allow
changes to the pointer itself.

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

end of thread, other threads:[~2023-05-16 13:25 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09  3:02 [Bug fortran/99982] New: INTERFACE selects wrong module procedure involving C_PTR and C_FUNPTR brtnfld at hdfgroup dot org
2021-04-21  4:53 ` [Bug fortran/99982] " brtnfld at hdfgroup dot org
2022-04-20 16:24 ` thierry at FreeBSD dot org
2022-04-20 19:19 ` anlauf at gcc dot gnu.org
2023-03-22 16:41 ` brtnfld at hdfgroup dot org
2023-03-22 17:08 ` brtnfld at hdfgroup dot org
2023-04-11 14:56 ` anlauf at gcc dot gnu.org
2023-04-12  9:14 ` cvs-commit at gcc dot gnu.org
2023-04-12  9:21 ` anlauf at gcc dot gnu.org
2023-04-12 13:56 ` brtnfld at hdfgroup dot org
2023-04-23 18:53 ` cvs-commit at gcc dot gnu.org
2023-05-16 13:25 ` brtnfld at hdfgroup dot org

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