public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/36459]  New: Wrong interface use for PROCEDURE(<abstr.interface_name)
@ 2008-06-07 18:25 burnus at gcc dot gnu dot org
  2008-06-07 20:15 ` [Bug fortran/36459] " janus at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-06-07 18:25 UTC (permalink / raw)
  To: gcc-bugs

The following valid program is rejected. The problem is that gfortran assigns
the interface of the INTRINSIC function "cos" to "f" and not the one of the
abstract interface. If one uses "interface" instead of "abstract interface" it
works.

abstract interface
  function dim()
    integer :: dim
  end function dim
end interface
procedure(dim) :: f
print *, f()
end


-- 
           Summary: Wrong interface use for PROCEDURE(<abstr.interface_name)
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36459


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

* [Bug fortran/36459] Wrong interface use for PROCEDURE(<abstr.interface_name)
  2008-06-07 18:25 [Bug fortran/36459] New: Wrong interface use for PROCEDURE(<abstr.interface_name) burnus at gcc dot gnu dot org
@ 2008-06-07 20:15 ` janus at gcc dot gnu dot org
  2008-06-07 21:02 ` janus at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu dot org @ 2008-06-07 20:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from janus at gcc dot gnu dot org  2008-06-07 20:15 -------

> The problem is that gfortran assigns the interface
> of the INTRINSIC function "cos" to "f"

You surely mean the intrinsic function DIM ;)


> If one uses "interface" instead of "abstract interface" it works.

No, for me it actually doesn't make a difference.
In particular the following is also rejected:

interface
  integer function dim()
  end function
end interface
procedure(dim) :: f
print *, dim()
end

Without the PROCEDURE line it works fine.


-- 

janus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-06-07 20:15:13
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36459


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

* [Bug fortran/36459] Wrong interface use for PROCEDURE(<abstr.interface_name)
  2008-06-07 18:25 [Bug fortran/36459] New: Wrong interface use for PROCEDURE(<abstr.interface_name) burnus at gcc dot gnu dot org
  2008-06-07 20:15 ` [Bug fortran/36459] " janus at gcc dot gnu dot org
@ 2008-06-07 21:02 ` janus at gcc dot gnu dot org
  2008-06-07 21:16 ` burnus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu dot org @ 2008-06-07 21:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from janus at gcc dot gnu dot org  2008-06-07 21:01 -------
This patch fixes both of the test cases in comment #0 and comment#1:

Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c  (revision 136533)
+++ gcc/fortran/decl.c  (working copy)
@@ -4085,8 +4085,10 @@ match_procedure_decl (void)
          return MATCH_ERROR;
        }
       /* Handle intrinsic procedures.  */
-      if (gfc_intrinsic_name (proc_if->name, 0)
-         || gfc_intrinsic_name (proc_if->name, 1))
+      if (!(proc_if->attr.external || proc_if->attr.use_assoc
+           || proc_if->attr.if_source == IFSRC_IFBODY)
+         && (gfc_intrinsic_name (proc_if->name, 0)
+             || gfc_intrinsic_name (proc_if->name, 1)))
        proc_if->attr.intrinsic = 1;
       if (proc_if->attr.intrinsic
          && !gfc_intrinsic_actual_ok (proc_if->name, 0))

This is the same check that's done in resolve.c (resolve_actual_arglist) for
dummy procedures.


-- 

janus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |janus at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2008-06-07 20:15:13         |2008-06-07 21:01:38
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36459


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

* [Bug fortran/36459] Wrong interface use for PROCEDURE(<abstr.interface_name)
  2008-06-07 18:25 [Bug fortran/36459] New: Wrong interface use for PROCEDURE(<abstr.interface_name) burnus at gcc dot gnu dot org
  2008-06-07 20:15 ` [Bug fortran/36459] " janus at gcc dot gnu dot org
  2008-06-07 21:02 ` janus at gcc dot gnu dot org
@ 2008-06-07 21:16 ` burnus at gcc dot gnu dot org
  2008-06-08 11:57 ` janus at gcc dot gnu dot org
  2008-06-08 12:17 ` [Bug fortran/36459] Wrong interface use for PROCEDURE janus at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-06-07 21:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2008-06-07 21:15 -------
> This is the same check that's done in resolve.c (resolve_actual_arglist) for
> dummy procedures.

Thanks for the quick patch.
(Do you think my patch for PR35830 is OK? Off topic: I'd really like to see
proc pointers being checked in; one can still work afterwards on related PRs
such as PR36322 or loosely related PRs PR35831 and PR36426.)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36459


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

* [Bug fortran/36459] Wrong interface use for PROCEDURE(<abstr.interface_name)
  2008-06-07 18:25 [Bug fortran/36459] New: Wrong interface use for PROCEDURE(<abstr.interface_name) burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-06-07 21:16 ` burnus at gcc dot gnu dot org
@ 2008-06-08 11:57 ` janus at gcc dot gnu dot org
  2008-06-08 12:17 ` [Bug fortran/36459] Wrong interface use for PROCEDURE janus at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu dot org @ 2008-06-08 11:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from janus at gcc dot gnu dot org  2008-06-08 11:56 -------
Subject: Bug 36459

Author: janus
Date: Sun Jun  8 11:55:41 2008
New Revision: 136555

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=136555
Log:
2008-06-08  Janus Weil  <janus@gcc.gnu.org>

        PR fortran/36459
        * decl.c (match_procedure_decl): Correctly recognize if the interface
        is an intrinsic procedure.


2008-06-08  Janus Weil  <janus@gcc.gnu.org>

        PR fortran/36459
        * gfortran.dg/proc_decl_16.f90: New.

Added:
    trunk/gcc/testsuite/gfortran.dg/proc_decl_16.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36459


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

* [Bug fortran/36459] Wrong interface use for PROCEDURE
  2008-06-07 18:25 [Bug fortran/36459] New: Wrong interface use for PROCEDURE(<abstr.interface_name) burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-06-08 11:57 ` janus at gcc dot gnu dot org
@ 2008-06-08 12:17 ` janus at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu dot org @ 2008-06-08 12:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from janus at gcc dot gnu dot org  2008-06-08 12:16 -------
Fixed in rev 136555. Closing.


-- 

janus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
            Summary|Wrong interface use for     |Wrong interface use for
                   |PROCEDURE(<abstr.interface_n|PROCEDURE
                   |ame)                        |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36459


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

end of thread, other threads:[~2008-06-08 12:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-07 18:25 [Bug fortran/36459] New: Wrong interface use for PROCEDURE(<abstr.interface_name) burnus at gcc dot gnu dot org
2008-06-07 20:15 ` [Bug fortran/36459] " janus at gcc dot gnu dot org
2008-06-07 21:02 ` janus at gcc dot gnu dot org
2008-06-07 21:16 ` burnus at gcc dot gnu dot org
2008-06-08 11:57 ` janus at gcc dot gnu dot org
2008-06-08 12:17 ` [Bug fortran/36459] Wrong interface use for PROCEDURE janus at gcc dot gnu 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).