public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/45366]  New: Problem with abstract interface to PURE function
@ 2010-08-21 12:30 mrestelli at gmail dot com
  2010-08-22 10:50 ` [Bug fortran/45366] " janus at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: mrestelli at gmail dot com @ 2010-08-21 12:30 UTC (permalink / raw)
  To: gcc-bugs

Hi all,
   gfortran refuses the attached code as

pure function i_g(x,p) result(y)
                     1
Error: Dummy procedure 'p' of PURE procedure at (1) must also be PURE

Notice however that i_f is an abstract interface to a PURE function.
(As a comment, ifort accepts the code.)


module m1
 implicit none
 abstract interface
  pure function i_f(x) result(y)
   real, intent(in) :: x
   real :: y
  end function i_f
 end interface
end module m1

module m2
 use m1, only: i_f
 implicit none
contains
 pure function i_g(x,p) result(y)
  real, intent(in) :: x
  procedure(i_f), pointer, intent(in) :: p
  real :: y
   y = p(x)
 end function i_g
end module m2


-- 
           Summary: Problem with abstract interface to PURE function
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mrestelli at gmail dot com
 GCC build triplet: GNU Fortran (GCC) 4.6.0 20100821 (experimental)
  GCC host triplet: AMD Turion(tm) 64 Mobile Technology ML-32 AuthenticAMD
                    GNU/Linux


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


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

* [Bug fortran/45366] Problem with abstract interface to PURE function
  2010-08-21 12:30 [Bug fortran/45366] New: Problem with abstract interface to PURE function mrestelli at gmail dot com
@ 2010-08-22 10:50 ` janus at gcc dot gnu dot org
  2010-08-22 11:02 ` burnus 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 @ 2010-08-22 10:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from janus at gcc dot gnu dot org  2010-08-22 10:50 -------
Confirmed. Thanks for reporting.


-- 

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|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
           Keywords|                            |rejects-valid
   Last reconfirmed|0000-00-00 00:00:00         |2010-08-22 10:50:10
               date|                            |


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


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

* [Bug fortran/45366] Problem with abstract interface to PURE function
  2010-08-21 12:30 [Bug fortran/45366] New: Problem with abstract interface to PURE function mrestelli at gmail dot com
  2010-08-22 10:50 ` [Bug fortran/45366] " janus at gcc dot gnu dot org
@ 2010-08-22 11:02 ` burnus at gcc dot gnu dot org
  2010-08-22 11:10 ` janus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-08-22 11:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2010-08-22 11:02 -------
Note: The ABSTRACT, the INTERFACE (vs. host-association), and the
use-association of i_f do not seem to play a role.

In particular for p:
  sym->attr.pure == 0
  sym->attr.proc_pointer == 1
  sym->ts.interface->attr.pure == 1

The problems seems to be that resolve_symbol is called later than the
resolve_formal_arglist check for pureness, i.e. one first checks whether "p" is
pure before one copies the attr.pure from ts.interface->attr.pure - which
explains the failure.

I leave the fixing to Janus.


-- 


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


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

* [Bug fortran/45366] Problem with abstract interface to PURE function
  2010-08-21 12:30 [Bug fortran/45366] New: Problem with abstract interface to PURE function mrestelli at gmail dot com
  2010-08-22 10:50 ` [Bug fortran/45366] " janus at gcc dot gnu dot org
  2010-08-22 11:02 ` burnus at gcc dot gnu dot org
@ 2010-08-22 11:10 ` janus at gcc dot gnu dot org
  2010-08-23 12:27 ` [Bug fortran/45366] Problem with procedure pointer dummy in " janus at gcc dot gnu dot org
  2010-08-23 12:29 ` janus at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-08-22 11:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from janus at gcc dot gnu dot org  2010-08-22 11:10 -------
(In reply to comment #2)
> The problems seems to be that resolve_symbol is called later than the
> resolve_formal_arglist check for pureness, i.e. one first checks whether "p" is
> pure before one copies the attr.pure from ts.interface->attr.pure - which
> explains the failure.

Exactly. I'm regtesting a patch right now.


-- 


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


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

* [Bug fortran/45366] Problem with procedure pointer dummy in PURE function
  2010-08-21 12:30 [Bug fortran/45366] New: Problem with abstract interface to PURE function mrestelli at gmail dot com
                   ` (2 preceding siblings ...)
  2010-08-22 11:10 ` janus at gcc dot gnu dot org
@ 2010-08-23 12:27 ` janus at gcc dot gnu dot org
  2010-08-23 12:29 ` janus at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-08-23 12:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from janus at gcc dot gnu dot org  2010-08-23 12:26 -------
Subject: Bug 45366

Author: janus
Date: Mon Aug 23 12:26:42 2010
New Revision: 163468

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

        PR fortran/45366
        * resolve.c (resolve_procedure_interface): New function split off from
        'resolve_symbol'.
        (resolve_formal_arglist): Call it here ...
        (resolve_symbol): ... and here.


2010-08-23  Janus Weil  <janus@gcc.gnu.org>

        PR fortran/45366
        * gfortran.dg/proc_ptr_29.f90: New.

Added:
    trunk/gcc/testsuite/gfortran.dg/proc_ptr_29.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/45366] Problem with procedure pointer dummy in PURE function
  2010-08-21 12:30 [Bug fortran/45366] New: Problem with abstract interface to PURE function mrestelli at gmail dot com
                   ` (3 preceding siblings ...)
  2010-08-23 12:27 ` [Bug fortran/45366] Problem with procedure pointer dummy in " janus at gcc dot gnu dot org
@ 2010-08-23 12:29 ` janus at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-08-23 12:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from janus at gcc dot gnu dot org  2010-08-23 12:29 -------
Fixed with r163468. Closing.


-- 

janus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to fail|                            |4.4.3 4.5.2 4.6.0
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2010-08-23 12:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-21 12:30 [Bug fortran/45366] New: Problem with abstract interface to PURE function mrestelli at gmail dot com
2010-08-22 10:50 ` [Bug fortran/45366] " janus at gcc dot gnu dot org
2010-08-22 11:02 ` burnus at gcc dot gnu dot org
2010-08-22 11:10 ` janus at gcc dot gnu dot org
2010-08-23 12:27 ` [Bug fortran/45366] Problem with procedure pointer dummy in " janus at gcc dot gnu dot org
2010-08-23 12:29 ` 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).