public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/42481] New: generic interface not recognized
@ 2009-12-23 15:22 william dot mitchell at nist dot gov
2009-12-23 22:32 ` [Bug fortran/42481] " anlauf at gmx dot de
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: william dot mitchell at nist dot gov @ 2009-12-23 15:22 UTC (permalink / raw)
To: gcc-bugs
! In this program, gfortran fails to identify the generic interface sub for
! sub_int. The compiler gives this error message:
!
! > gfortran prog.f90
! prog.f90:40.9:
!
! call sub(1)
! 1
! Error: Type mismatch in argument 'x' at (1); passed INTEGER(4) to REAL(4)
!
! However, if the use statements in program prog are switched so that
! use mod2 comes before use mod1, it correctly identifies the generic
! interface and compiles.
!
! This is with the following version of gfortran:
! > gfortran --version
! GNU Fortran (GCC) 4.5.0 20091205 (experimental) [trunk revision 155016]
module mod1
contains
subroutine sub(x)
real x
end subroutine sub
end module mod1
module mod2
use mod1
interface sub
module procedure sub, sub_int
end interface sub
contains
subroutine sub_int(i)
integer i
end subroutine sub_int
end module mod2
program prog
use mod1
use mod2
call sub(1)
end program prog
--
Summary: generic interface not recognized
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: william dot mitchell at nist dot gov
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42481
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/42481] generic interface not recognized
2009-12-23 15:22 [Bug fortran/42481] New: generic interface not recognized william dot mitchell at nist dot gov
@ 2009-12-23 22:32 ` anlauf at gmx dot de
2009-12-23 22:39 ` anlauf at gmx dot de
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: anlauf at gmx dot de @ 2009-12-23 22:32 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from anlauf at gmx dot de 2009-12-23 22:31 -------
(In reply to comment #0)
Funny, ifort 11.1, xlf 12.1.0.5 and Sunstudio 12.1 accept the code,
but nagfor 5.2 rejects it with:
NAG Fortran Compiler Release 5.2(686)
Warning: prog.f90, line 23: Unused dummy variable X
detected at SUB@<end-of-statement>
Warning: prog.f90, line 34: Unused dummy variable I
detected at SUB_INT@<end-of-statement>
Error: prog.f90, line 40: Symbol SUB found both in module MOD1 and in MOD2
detected at CALL@SUB
[NAG Fortran Compiler pass 1 error termination, 1 error, 2 warnings]
--
anlauf at gmx dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anlauf at gmx dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42481
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/42481] generic interface not recognized
2009-12-23 15:22 [Bug fortran/42481] New: generic interface not recognized william dot mitchell at nist dot gov
2009-12-23 22:32 ` [Bug fortran/42481] " anlauf at gmx dot de
@ 2009-12-23 22:39 ` anlauf at gmx dot de
2010-01-05 9:20 ` burnus at gcc dot gnu dot org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: anlauf at gmx dot de @ 2009-12-23 22:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from anlauf at gmx dot de 2009-12-23 22:39 -------
Note that I personally would declare sub as generic in mod1, e.g.
module mod1
interface sub
module procedure sub
end interface
contains
subroutine sub(x)
real x
end subroutine sub
end module mod1
and remove the corresponding module procedure in mod2, as this resolves
the compilation errors with gfortran and nagfor.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42481
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/42481] generic interface not recognized
2009-12-23 15:22 [Bug fortran/42481] New: generic interface not recognized william dot mitchell at nist dot gov
2009-12-23 22:32 ` [Bug fortran/42481] " anlauf at gmx dot de
2009-12-23 22:39 ` anlauf at gmx dot de
@ 2010-01-05 9:20 ` burnus at gcc dot gnu dot org
2010-01-13 22:16 ` pault at gcc dot gnu dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-01-05 9:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from burnus at gcc dot gnu dot org 2010-01-05 09:20 -------
See also
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/b128e5ed244a2516
Richard Maine thinks it is valid - and I also do not see (ad hoc) any reason
why it should be invalid.
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO| |32834
nThis| |
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |rejects-valid
Last reconfirmed|0000-00-00 00:00:00 |2010-01-05 09:20:12
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42481
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/42481] generic interface not recognized
2009-12-23 15:22 [Bug fortran/42481] New: generic interface not recognized william dot mitchell at nist dot gov
` (2 preceding siblings ...)
2010-01-05 9:20 ` burnus at gcc dot gnu dot org
@ 2010-01-13 22:16 ` pault at gcc dot gnu dot org
2010-01-14 6:14 ` pault at gcc dot gnu dot org
2010-01-14 6:19 ` pault at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu dot org @ 2010-01-13 22:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pault at gcc dot gnu dot org 2010-01-13 22:16 -------
I am just about to post a fix.
Paul
--
pault at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pault at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2010-01-05 09:20:12 |2010-01-13 22:16:32
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42481
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/42481] generic interface not recognized
2009-12-23 15:22 [Bug fortran/42481] New: generic interface not recognized william dot mitchell at nist dot gov
` (3 preceding siblings ...)
2010-01-13 22:16 ` pault at gcc dot gnu dot org
@ 2010-01-14 6:14 ` pault at gcc dot gnu dot org
2010-01-14 6:19 ` pault at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu dot org @ 2010-01-14 6:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pault at gcc dot gnu dot org 2010-01-14 06:13 -------
Subject: Bug 42481
Author: pault
Date: Thu Jan 14 06:13:19 2010
New Revision: 155876
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155876
Log:
2010-01-14 Paul Thomas <pault@gcc.gnu.org>
PR fortran/42481
* module.c (load_generic_interfaces): If a procedure that is
use associated but not generic is given an interface that
includes itself, then make it generic.
2010-01-14 Paul Thomas <pault@gcc.gnu.org>
PR fortran/42481
* gfortran.dg/generic_19.f90 : New test.
Added:
trunk/gcc/testsuite/gfortran.dg/generic_19.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/module.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42481
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/42481] generic interface not recognized
2009-12-23 15:22 [Bug fortran/42481] New: generic interface not recognized william dot mitchell at nist dot gov
` (4 preceding siblings ...)
2010-01-14 6:14 ` pault at gcc dot gnu dot org
@ 2010-01-14 6:19 ` pault at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu dot org @ 2010-01-14 6:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from pault at gcc dot gnu dot org 2010-01-14 06:19 -------
Fixed on trunk.
Thanks for the report
Paul
--
pault at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42481
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-01-14 6:19 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-23 15:22 [Bug fortran/42481] New: generic interface not recognized william dot mitchell at nist dot gov
2009-12-23 22:32 ` [Bug fortran/42481] " anlauf at gmx dot de
2009-12-23 22:39 ` anlauf at gmx dot de
2010-01-05 9:20 ` burnus at gcc dot gnu dot org
2010-01-13 22:16 ` pault at gcc dot gnu dot org
2010-01-14 6:14 ` pault at gcc dot gnu dot org
2010-01-14 6:19 ` 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).