public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/21961] New: PURE function in INTERFACE block not resolved as being a function
@ 2005-06-08 14:35 mhesseli at caltech dot edu
  2005-06-18 18:42 ` [Bug fortran/21961] " fxcoudert at gcc dot gnu dot org
  0 siblings, 1 reply; 3+ messages in thread
From: mhesseli at caltech dot edu @ 2005-06-08 14:35 UTC (permalink / raw)
  To: gcc-bugs

A PURE function that is part of an INTERFACE block is not resolved as being a
function. Gfortran gives the following warning for the code attached at the end
of this description:

module_procedure-1.f90: In function 'show':
module_procedure-1.f90:30: warning: unused variable 'test'

I originally tested this using GNU Fortran 95 (GCC 4.1.0 20050602
(experimental)) and retested it using GNU Fortran 95 (GCC 4.1.0 20050608
(experimental)).

---

MODULE procedures
   PUBLIC               :: test

   PRIVATE              :: test1,test2

   INTERFACE test
      MODULE PROCEDURE test1,test2
   END INTERFACE test
CONTAINS
   PURE FUNCTION test1 (x) RESULT(r)
      REAL(KIND(0.0d0)), INTENT(IN) :: x
      REAL(KIND(0.0d0))             :: r

      r=x+1.0d0
   END FUNCTION test1

   PURE FUNCTION test2 (x) RESULT(r)
      REAL(KIND(0.0d0)), DIMENSION(:), INTENT(IN)  :: x
      REAL(KIND(0.0d0)), DIMENSION(SIZE(x))        :: r

      FORALL (i=1:SIZE(x))
         r(i)=x(i)+1.0d0
      END FORALL
   END FUNCTION test2
END MODULE procedures

MODULE actions
   USE procedures
CONTAINS
   SUBROUTINE show (x)
      REAL(KIND(0.0d0)), DIMENSION(:)        :: x
      REAL(KIND(0.0d0)), DIMENSION(SIZE(x))  :: d

      d=test (x)
      WRITE (*,'(F8.6)') d
   END SUBROUTINE show
END MODULE actions

PROGRAM module_procedure_1
   USE actions

   REAL(KIND(0.0d0)), DIMENSION(2)  :: x

   x=(/ 1.0d0,0.0d0 /)

   CALL show (x)

END PROGRAM module_procedure_1

-- 
           Summary: PURE function in INTERFACE block not resolved as being a
                    function
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mhesseli at caltech dot edu
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-apple-darwin7.9.0
  GCC host triplet: powerpc-apple-darwin7.9.0
GCC target triplet: powerpc-apple-darwin7.9.0


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


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

* [Bug fortran/21961] PURE function in INTERFACE block not resolved as being a function
  2005-06-08 14:35 [Bug fortran/21961] New: PURE function in INTERFACE block not resolved as being a function mhesseli at caltech dot edu
@ 2005-06-18 18:42 ` fxcoudert at gcc dot gnu dot org
  0 siblings, 0 replies; 3+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-06-18 18:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From fxcoudert at gcc dot gnu dot org  2005-06-18 18:42 -------
Confirmed, we should not issue such warning. Here is a (slightly) reduced testcase:

MODULE procedures
   PUBLIC :: test
   PRIVATE :: test2
   INTERFACE test
      MODULE PROCEDURE test2
   END INTERFACE test
CONTAINS
   PURE INTEGER FUNCTION test2 ()
      test2 = 0
   END FUNCTION test2
END MODULE procedures

MODULE actions
   USE procedures
CONTAINS
   SUBROUTINE show
      print *, test ()
   END SUBROUTINE show
END MODULE actions

PROGRAM module_procedure_1
   USE actions
   CALL show
END PROGRAM module_procedure_1

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-06-18 18:42:50
               date|                            |


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


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

* [Bug fortran/21961] PURE function in INTERFACE block not resolved as being a function
       [not found] <bug-21961-9546@http.gcc.gnu.org/bugzilla/>
@ 2006-01-29 19:52 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-29 19:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-01-29 19:52 -------
Fixed in 4.1.0 at least.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.1.0


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


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

end of thread, other threads:[~2006-01-29 19:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-08 14:35 [Bug fortran/21961] New: PURE function in INTERFACE block not resolved as being a function mhesseli at caltech dot edu
2005-06-18 18:42 ` [Bug fortran/21961] " fxcoudert at gcc dot gnu dot org
     [not found] <bug-21961-9546@http.gcc.gnu.org/bugzilla/>
2006-01-29 19:52 ` pinskia 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).