public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/40461]  New: Interface mismatch in dummy procedure
@ 2009-06-16 15:20 michael dot a dot richmond at nasa dot gov
  2009-06-16 17:36 ` [Bug fortran/40461] " burnus at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: michael dot a dot richmond at nasa dot gov @ 2009-06-16 15:20 UTC (permalink / raw)
  To: gcc-bugs

I downloaded
http://users.physik.fu-berlin.de/~tburnus/gcc-trunk/gcc-trunk-x86_64.tar.gz and
attempted to compile the following module:

MODULE Nonlin_Conf_Regions
CONTAINS
SUBROUTINE halprn(deriv)
INTERFACE
  SUBROUTINE deriv(wt)
    REAL, INTENT(IN)     :: wt
  END SUBROUTINE deriv
END INTERFACE
END SUBROUTINE halprn
END MODULE Nonlin_Conf_Regions

PROGRAM Test_AS290
USE Nonlin_Conf_Regions
INTERFACE
  SUBROUTINE Logistic4(wt)
    REAL, INTENT(OUT)  :: wt
  END SUBROUTINE Logistic4
END INTERFACE
CALL halprn(Logistic4)
END PROGRAM Test_AS290

I got the message:

u.f90:19.12:

CALL halprn(Logistic4)
            1
Error: Interface mismatch in dummy procedure 'deriv' at (1): INTENT mismatch in
argument 'wt'

This is presumably connected with PR 36947/40039 written by Janus Weil. I don't
know whether the error message is valid.


-- 
           Summary: Interface mismatch in dummy procedure
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: michael dot a dot richmond at nasa dot gov


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


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

* [Bug fortran/40461] Interface mismatch in dummy procedure
  2009-06-16 15:20 [Bug fortran/40461] New: Interface mismatch in dummy procedure michael dot a dot richmond at nasa dot gov
@ 2009-06-16 17:36 ` burnus at gcc dot gnu dot org
  2009-06-16 17:50 ` janus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-06-16 17:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2009-06-16 17:36 -------
I think the error is a valid error. For comparison, NAG f95 5.1 shows the
following error message:

Error: line 19: Dummy proc DERIV arg 1 has different INTENT from actual proc
LOGISTIC4 arg
Error: line 19: Incompatible procedure argument for DERIV (no. 1) of HALPRN

 * * *

Independent from what the standard says, I think the error message makes sense:

If one calls in "SUBROUTINE halprn" the dummy "subroutine deriv" as, e.g.,
  call deriv(5)
that is perfectly correct. But the actual argument is "Logistic4" and as its
first argument is INTENT(OUT), the argument needs to be definable, which "5"
clearly isn't.

I think there is no other solution than to fix it. A work around is to use no
INTENT at either place, but I think arithmetically either INTENT(IN) or
INTENT(OUT) is correct (or INTENT(INOUT)) but having once IN and once OUT is
really bug in your program.


-- 


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


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

* [Bug fortran/40461] Interface mismatch in dummy procedure
  2009-06-16 15:20 [Bug fortran/40461] New: Interface mismatch in dummy procedure michael dot a dot richmond at nasa dot gov
  2009-06-16 17:36 ` [Bug fortran/40461] " burnus at gcc dot gnu dot org
@ 2009-06-16 17:50 ` janus at gcc dot gnu dot org
  2009-06-18  8:49 ` burnus at gcc dot gnu dot org
  2009-06-18  9:04 ` dominiq at lps dot ens dot fr
  3 siblings, 0 replies; 5+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-06-16 17:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from janus at gcc dot gnu dot org  2009-06-16 17:50 -------
(In reply to comment #0)
> This is presumably connected with PR 36947/40039 written by Janus Weil.

Indeed.


> I don't know whether the error message is valid.

It surely is, since the interfaces of your subroutines 'Logistic4' and 'deriv'
just don't match (their arguments should have the same intent).


-- 


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


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

* [Bug fortran/40461] Interface mismatch in dummy procedure
  2009-06-16 15:20 [Bug fortran/40461] New: Interface mismatch in dummy procedure michael dot a dot richmond at nasa dot gov
  2009-06-16 17:36 ` [Bug fortran/40461] " burnus at gcc dot gnu dot org
  2009-06-16 17:50 ` janus at gcc dot gnu dot org
@ 2009-06-18  8:49 ` burnus at gcc dot gnu dot org
  2009-06-18  9:04 ` dominiq at lps dot ens dot fr
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-06-18  8:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2009-06-18 08:49 -------
I close this as INVALID. If you have suggestions how to improve the diagnostics
or if you disagree, feel free to reopen the bug.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug fortran/40461] Interface mismatch in dummy procedure
  2009-06-16 15:20 [Bug fortran/40461] New: Interface mismatch in dummy procedure michael dot a dot richmond at nasa dot gov
                   ` (2 preceding siblings ...)
  2009-06-18  8:49 ` burnus at gcc dot gnu dot org
@ 2009-06-18  9:04 ` dominiq at lps dot ens dot fr
  3 siblings, 0 replies; 5+ messages in thread
From: dominiq at lps dot ens dot fr @ 2009-06-18  9:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dominiq at lps dot ens dot fr  2009-06-18 09:03 -------
> I close this as INVALID.

Late note: ifort gives an error also

pr40461.f90(19): error #7061: The characteristics of dummy argument 1 of the
associated actual procedure differ from the characteristics of dummy argument 1
of the dummy procedure. (12.2)   [LOGISTIC4]
CALL halprn(Logistic4)
------------^
compilation aborted for pr40461.f90 (code 1)


-- 


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


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

end of thread, other threads:[~2009-06-18  9:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-16 15:20 [Bug fortran/40461] New: Interface mismatch in dummy procedure michael dot a dot richmond at nasa dot gov
2009-06-16 17:36 ` [Bug fortran/40461] " burnus at gcc dot gnu dot org
2009-06-16 17:50 ` janus at gcc dot gnu dot org
2009-06-18  8:49 ` burnus at gcc dot gnu dot org
2009-06-18  9:04 ` dominiq at lps dot ens dot fr

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