public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/45836] New: Fortran 2003 - Type Bound Procedure Error - Type Mismatch
@ 2010-09-29 20:27 ortp21 at gmail dot com
2010-09-29 20:43 ` [Bug fortran/45836] [OOP] " burnus at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: ortp21 at gmail dot com @ 2010-09-29 20:27 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45836
Summary: Fortran 2003 - Type Bound Procedure Error - Type
Mismatch
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: ortp21@gmail.com
The following error is produced by the example typeboundprocedure.f95, pasted
below:
Error
----------------------------------------------
typeboundprocedure.f95:46.12:
print *, b_type_instance%sizeReturn()
1
Error: Type mismatch in argument 'a_type_' at (1); passed TYPE(b_type) to
CLASS(a_type)
----------------------------------------------
I have tested the same example using the Intel Fortran Compiler 11.1 on Linux
and it compiles without error.
Compiled using:
gfortran -c typeboundprocedure.f95
typeboundprocedure.f95
----------------------------------------------
module A
implicit none
type :: a_type
private
integer :: size = 1
contains
procedure :: sizeReturn
end type a_type
contains
function sizeReturn( a_type_ )
implicit none
integer :: sizeReturn
class(a_type) :: a_type_
sizeReturn = a_type_%size
end function sizeReturn
end module A
module B
implicit none
type :: b_type
private
integer :: size = 2
contains
procedure :: sizeReturn
end type b_type
contains
function sizeReturn( b_type_ )
implicit none
integer :: sizeReturn
class(b_type) :: b_type_
sizeReturn = b_type_%size
end function sizeReturn
end module B
program main
use A
use B
implicit none
type(a_type) :: a_type_instance
type(b_type) :: b_type_instance
print *, a_type_instance%sizeReturn()
print *, b_type_instance%sizeReturn()
end program main
----------------------------------------------
Using built-in specs.
COLLECT_GCC=gfortran
Target: x86_64-apple-darwin10.4.0
Configured with: ../gcc-4.6-20100925/configure --prefix=~$HOME/gcc-trunk
--enable-languages=fortran --enable-checking=release --disable-bootstrap
Thread model: posix
gcc version 4.6.0 20100925 (experimental) (GCC)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/45836] [OOP] Fortran 2003 - Type Bound Procedure Error - Type Mismatch
2010-09-29 20:27 [Bug fortran/45836] New: Fortran 2003 - Type Bound Procedure Error - Type Mismatch ortp21 at gmail dot com
@ 2010-09-29 20:43 ` burnus at gcc dot gnu.org
2010-09-30 2:06 ` ortp21 at gmail dot com
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2010-09-29 20:43 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45836
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
CC| |janus at gcc dot gnu.org
Summary|Fortran 2003 - Type Bound |[OOP] Fortran 2003 - Type
|Procedure Error - Type |Bound Procedure Error -
|Mismatch |Type Mismatch
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-09-29 16:17:30 UTC ---
The problem is that the name of the module procedure is the same for both TBP;
that's valid but seemingly does not work.
Variant A: Without use-associating the ambiguous "sizeReturn" the program
works:
use A, only: a_type
use B, only: b_type
Variant B: Only importing one of the "sizeReturn" also works:
use A, only: a_type
use B, only: b_type, sizeReturn
or
use A, only: a_type
use B
However, using just
use A
use B
or even
use A, only: a_type, sizeReturn
use B, only: b_type, sizeReturn
does not. (This use associates both "sizeReturn", which is valid as long as one
does use "sizeReturn"; if one would use the symbol, it's an error as the symbol
is ambiguous.)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/45836] [OOP] Fortran 2003 - Type Bound Procedure Error - Type Mismatch
2010-09-29 20:27 [Bug fortran/45836] New: Fortran 2003 - Type Bound Procedure Error - Type Mismatch ortp21 at gmail dot com
2010-09-29 20:43 ` [Bug fortran/45836] [OOP] " burnus at gcc dot gnu.org
@ 2010-09-30 2:06 ` ortp21 at gmail dot com
2010-10-01 9:40 ` janus at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: ortp21 at gmail dot com @ 2010-09-30 2:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45836
--- Comment #2 from ortp21 at gmail dot com 2010-09-29 20:24:24 UTC ---
Tobias,
Thank you for the workaround variants. I have used them instead of what I was
trying to do, with success.
I hope the bug report was worthwhile/accurate.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/45836] [OOP] Fortran 2003 - Type Bound Procedure Error - Type Mismatch
2010-09-29 20:27 [Bug fortran/45836] New: Fortran 2003 - Type Bound Procedure Error - Type Mismatch ortp21 at gmail dot com
2010-09-29 20:43 ` [Bug fortran/45836] [OOP] " burnus at gcc dot gnu.org
2010-09-30 2:06 ` ortp21 at gmail dot com
@ 2010-10-01 9:40 ` janus at gcc dot gnu.org
2013-01-06 15:50 ` [Bug fortran/45836] [OOP] " mikael at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: janus at gcc dot gnu.org @ 2010-10-01 9:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45836
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2010.10.01 09:40:38
Ever Confirmed|0 |1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/45836] [OOP] Type Bound Procedure Error - Type Mismatch
2010-09-29 20:27 [Bug fortran/45836] New: Fortran 2003 - Type Bound Procedure Error - Type Mismatch ortp21 at gmail dot com
` (2 preceding siblings ...)
2010-10-01 9:40 ` janus at gcc dot gnu.org
@ 2013-01-06 15:50 ` mikael at gcc dot gnu.org
2013-01-08 19:43 ` mikael at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: mikael at gcc dot gnu.org @ 2013-01-06 15:50 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45836
--- Comment #3 from Mikael Morin <mikael at gcc dot gnu.org> 2013-01-06 15:50:23 UTC ---
Author: mikael
Date: Sun Jan 6 15:50:09 2013
New Revision: 194949
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194949
Log:
PR fortran/42769
PR fortran/45836
PR fortran/45900
* module.c (read_module): Don't reuse local symtree if the associated
symbol isn't exactly the one wanted. Don't reuse local symtree if it is
ambiguous.
* resolve.c (resolve_call): Use symtree's name instead of symbol's to
lookup the symtree.
PR fortran/42769
PR fortran/45836
PR fortran/45900
* gfortran.dg/use_23.f90: New test.
* gfortran.dg/use_24.f90: New test.
* gfortran.dg/use_25.f90: New test.
* gfortran.dg/use_26.f90: New test.
* gfortran.dg/use_27.f90: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/use_23.f90
trunk/gcc/testsuite/gfortran.dg/use_24.f90
trunk/gcc/testsuite/gfortran.dg/use_25.f90
trunk/gcc/testsuite/gfortran.dg/use_26.f90
trunk/gcc/testsuite/gfortran.dg/use_27.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/module.c
trunk/gcc/fortran/resolve.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/45836] [OOP] Type Bound Procedure Error - Type Mismatch
2010-09-29 20:27 [Bug fortran/45836] New: Fortran 2003 - Type Bound Procedure Error - Type Mismatch ortp21 at gmail dot com
` (3 preceding siblings ...)
2013-01-06 15:50 ` [Bug fortran/45836] [OOP] " mikael at gcc dot gnu.org
@ 2013-01-08 19:43 ` mikael at gcc dot gnu.org
2013-01-08 20:02 ` mikael at gcc dot gnu.org
2013-01-09 14:32 ` mikael at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: mikael at gcc dot gnu.org @ 2013-01-08 19:43 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45836
--- Comment #4 from Mikael Morin <mikael at gcc dot gnu.org> 2013-01-08 19:42:49 UTC ---
Author: mikael
Date: Tue Jan 8 19:42:38 2013
New Revision: 195031
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195031
Log:
PR fortran/42769
PR fortran/45836
PR fortran/45900
* module.c (read_module): Don't reuse local symtree if the associated
symbol isn't exactly the one wanted. Don't reuse local symtree if it is
ambiguous.
* resolve.c (resolve_call): Use symtree's name instead of symbol's to
lookup the symtree.
PR fortran/42769
PR fortran/45836
PR fortran/45900
* gfortran.dg/use_23.f90: New test.
* gfortran.dg/use_24.f90: New test.
* gfortran.dg/use_25.f90: New test.
* gfortran.dg/use_26.f90: New test.
* gfortran.dg/use_27.f90: New test.
Added:
branches/gcc-4_7-branch/gcc/testsuite/gfortran.dg/use_23.f90
branches/gcc-4_7-branch/gcc/testsuite/gfortran.dg/use_24.f90
branches/gcc-4_7-branch/gcc/testsuite/gfortran.dg/use_25.f90
branches/gcc-4_7-branch/gcc/testsuite/gfortran.dg/use_26.f90
branches/gcc-4_7-branch/gcc/testsuite/gfortran.dg/use_27.f90
Modified:
branches/gcc-4_7-branch/gcc/fortran/ChangeLog
branches/gcc-4_7-branch/gcc/fortran/module.c
branches/gcc-4_7-branch/gcc/fortran/resolve.c
branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/45836] [OOP] Type Bound Procedure Error - Type Mismatch
2010-09-29 20:27 [Bug fortran/45836] New: Fortran 2003 - Type Bound Procedure Error - Type Mismatch ortp21 at gmail dot com
` (4 preceding siblings ...)
2013-01-08 19:43 ` mikael at gcc dot gnu.org
@ 2013-01-08 20:02 ` mikael at gcc dot gnu.org
2013-01-09 14:32 ` mikael at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: mikael at gcc dot gnu.org @ 2013-01-08 20:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45836
--- Comment #5 from Mikael Morin <mikael at gcc dot gnu.org> 2013-01-08 20:02:01 UTC ---
Author: mikael
Date: Tue Jan 8 20:01:49 2013
New Revision: 195032
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195032
Log:
PR fortran/42769
PR fortran/45836
PR fortran/45900
* module.c (read_module): Don't reuse local symtree if the associated
symbol isn't exactly the one wanted. Don't reuse local symtree if it is
ambiguous.
* resolve.c (resolve_call): Use symtree's name instead of symbol's to
lookup the symtree.
PR fortran/42769
PR fortran/45836
PR fortran/45900
* gfortran.dg/use_23.f90: New test.
* gfortran.dg/use_24.f90: New test.
* gfortran.dg/use_25.f90: New test.
* gfortran.dg/use_26.f90: New test.
* gfortran.dg/use_27.f90: New test.
Added:
branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/use_23.f90
branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/use_24.f90
branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/use_25.f90
branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/use_26.f90
branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/use_27.f90
Modified:
branches/gcc-4_6-branch/gcc/fortran/ChangeLog
branches/gcc-4_6-branch/gcc/fortran/module.c
branches/gcc-4_6-branch/gcc/fortran/resolve.c
branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/45836] [OOP] Type Bound Procedure Error - Type Mismatch
2010-09-29 20:27 [Bug fortran/45836] New: Fortran 2003 - Type Bound Procedure Error - Type Mismatch ortp21 at gmail dot com
` (5 preceding siblings ...)
2013-01-08 20:02 ` mikael at gcc dot gnu.org
@ 2013-01-09 14:32 ` mikael at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: mikael at gcc dot gnu.org @ 2013-01-09 14:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45836
Mikael Morin <mikael at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |mikael at gcc dot gnu.org
Resolution| |FIXED
Target Milestone|--- |4.6.4
--- Comment #6 from Mikael Morin <mikael at gcc dot gnu.org> 2013-01-09 14:31:53 UTC ---
Fixed for 4.6.4 4.7.3 4.8.0.
Thanks for the bug report.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-01-09 14:32 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-29 20:27 [Bug fortran/45836] New: Fortran 2003 - Type Bound Procedure Error - Type Mismatch ortp21 at gmail dot com
2010-09-29 20:43 ` [Bug fortran/45836] [OOP] " burnus at gcc dot gnu.org
2010-09-30 2:06 ` ortp21 at gmail dot com
2010-10-01 9:40 ` janus at gcc dot gnu.org
2013-01-06 15:50 ` [Bug fortran/45836] [OOP] " mikael at gcc dot gnu.org
2013-01-08 19:43 ` mikael at gcc dot gnu.org
2013-01-08 20:02 ` mikael at gcc dot gnu.org
2013-01-09 14:32 ` mikael at gcc dot gnu.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).