public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/27122]  New: binary operator functions should require intent(in)
@ 2006-04-11 18:37 tkoenig at gcc dot gnu dot org
  2006-04-17  6:21 ` [Bug fortran/27122] " pault at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2006-04-11 18:37 UTC (permalink / raw)
  To: gcc-bugs

Binary operator functions require their arguments to have intent(in).
Gfortran currently doesn't enforce this, ifort does.

$ cat oper-fun.f90
module mymod
  interface operator (.foo.)
     module procedure foo_int
  end interface
contains
  function foo_int (a, b)
    integer:: foo_int
    integer :: a, b    ! <==== should be intent(in) here
    foo_int = a + 3 * b
  end function foo_int
end module mymod

program main
  use mymod
  print *, 1 .foo. 2
end program main
$ gfortran oper-fun.f90 && ./a.out
           7
$ ifort oper-fun.f90
fortcom: Error: oper-fun.f90, line 6: An explicit INTENT(IN) declaration is
expected for this dummy argument of the defined operation.   [A]
  function foo_int (a, b)
--------------------^
fortcom: Error: oper-fun.f90, line 6: An explicit INTENT(IN) declaration is
expected for this dummy argument of the defined operation.   [B]
  function foo_int (a, b)
-----------------------^
fortcom: Error: oper-fun.f90, line 14: Error in opening the Library module
file.   [MYMOD]
  use mymod
------^
fortcom: Error: oper-fun.f90, line 15: Dotted string neither a defined operator
nor a structure component   [FOO]
  print *, 1 .foo. 2
--------------^
compilation aborted for oper-fun.f90 (code 1)


-- 
           Summary: binary operator functions should require intent(in)
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org


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


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

end of thread, other threads:[~2006-04-23  5:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-11 18:37 [Bug fortran/27122] New: binary operator functions should require intent(in) tkoenig at gcc dot gnu dot org
2006-04-17  6:21 ` [Bug fortran/27122] " pault at gcc dot gnu dot org
2006-04-17 15:00 ` patchapp at dberlin dot org
2006-04-17 16:03 ` pinskia at gcc dot gnu dot org
2006-04-21  5:10 ` pault at gcc dot gnu dot org
2006-04-23  5:33 ` pault at gcc dot gnu dot org
2006-04-23  5:42 ` pault 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).