public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/57217] New: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check
@ 2013-05-08 17:32 burnus at gcc dot gnu.org
2013-05-09 9:55 ` [Bug fortran/57217] " burnus at gcc dot gnu.org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-05-08 17:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57217
Bug #: 57217
Summary: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP
overriding - lacking arguments check
Classification: Unclassified
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
CC: janus@gcc.gnu.org, salvatore.filippone@uniroma2.it
Reported by Salvatore; very vaguely related to PR47978.
In the following program, "clone" is overridden. The overridden procedure shall
use for the dummy arguments "CLASS(base_type)" instead of "CLASS(r_type)" as in
the original TBP - except for the PASS argument, which may be different.
GCC 4.6 prints:
procedure, pass(map) :: clone => r_clone
1
Error: Types mismatch for dummy argument 'mapout' of 'clone' (1) in respect to
the overridden procedure
F2008, "4.5.7.3 Type-bound procedure overriding":
"The overriding and overridden type-bound procedures shall satisfy the
following conditions.
[...] * Dummy arguments that correspond by position shall have the same names
and characteristics, except for the type of the passed-object dummy arguments."
module base_mod
type base_type
integer :: kind
contains
procedure, pass(map) :: clone => base_clone
end type base_type
contains
subroutine base_clone(map,mapout,info)
implicit none
class(base_type), intent(inout) :: map
class(base_type), intent(inout) :: mapout
integer :: info
end subroutine base_clone
end module base_mod
module r_mod
use base_mod
type, extends(base_type) :: r_type
real :: dat
contains
procedure, pass(map) :: clone => r_clone
end type r_type
contains
subroutine r_clone(map,mapout,info)
implicit none
class(r_type), intent(inout) :: map
class(r_type), intent(inout) :: mapout
integer :: info
end subroutine r_clone
end module r_mod
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/57217] [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check
2013-05-08 17:32 [Bug fortran/57217] New: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check burnus at gcc dot gnu.org
@ 2013-05-09 9:55 ` burnus at gcc dot gnu.org
2013-05-10 16:56 ` burnus at gcc dot gnu.org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-05-09 9:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57217
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-05-09 09:55:30 UTC ---
The problem is that gfc_check_typebound_override calls
check_dummy_characteristics -> compare_type_rank -> gfc_compare_types
But the latter accepts a type extension, which means that one has to also check
the reverse.
Patch:
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -4130,2 +4130,13 @@ gfc_check_typebound_override (gfc_symtree* proc,
gfc_symtree* old)
check_type = proc_pass_arg != argpos && old_pass_arg != argpos;
+ if (check_type
+ && (!gfc_compare_types (&proc_formal->sym->ts, &old_formal->sym->ts)
+ || !gfc_compare_types (&old_formal->sym->ts,
+ &proc_formal->sym->ts)))
+ {
+ gfc_error ("Argument type mismatch for the overriding procedure "
+ "'%s' at %L: %s vs %s", proc->name, &where,
+ gfc_typename (&proc_formal->sym->ts),
+ gfc_typename (&old_formal->sym->ts));
+ return false;
+ }
if (!check_dummy_characteristics (proc_formal->sym, old_formal->sym,
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/57217] [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check
2013-05-08 17:32 [Bug fortran/57217] New: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check burnus at gcc dot gnu.org
2013-05-09 9:55 ` [Bug fortran/57217] " burnus at gcc dot gnu.org
@ 2013-05-10 16:56 ` burnus at gcc dot gnu.org
2013-05-15 13:29 ` rguenth at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-05-10 16:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57217
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
See draft patch at http://gcc.gnu.org/ml/fortran/2013-05/msg00035.html (see
patch review for what is missing).
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/57217] [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check
2013-05-08 17:32 [Bug fortran/57217] New: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check burnus at gcc dot gnu.org
2013-05-09 9:55 ` [Bug fortran/57217] " burnus at gcc dot gnu.org
2013-05-10 16:56 ` burnus at gcc dot gnu.org
@ 2013-05-15 13:29 ` rguenth at gcc dot gnu.org
2013-05-28 7:15 ` janus at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-05-15 13:29 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57217
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
Target Milestone|--- |4.7.4
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/57217] [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check
2013-05-08 17:32 [Bug fortran/57217] New: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check burnus at gcc dot gnu.org
` (2 preceding siblings ...)
2013-05-15 13:29 ` rguenth at gcc dot gnu.org
@ 2013-05-28 7:15 ` janus at gcc dot gnu.org
2013-05-28 11:53 ` janus at gcc dot gnu.org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: janus at gcc dot gnu.org @ 2013-05-28 7:15 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57217
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2013-05-28
Assignee|unassigned at gcc dot gnu.org |janus at gcc dot gnu.org
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/57217] [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check
2013-05-08 17:32 [Bug fortran/57217] New: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check burnus at gcc dot gnu.org
` (3 preceding siblings ...)
2013-05-28 7:15 ` janus at gcc dot gnu.org
@ 2013-05-28 11:53 ` janus at gcc dot gnu.org
2013-05-28 12:06 ` janus at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: janus at gcc dot gnu.org @ 2013-05-28 11:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57217
--- Comment #3 from janus at gcc dot gnu.org ---
Fixed on trunk with:
Author: janus
Date: Tue May 28 11:21:44 2013
New Revision: 199375
URL: http://gcc.gnu.org/viewcvs?rev=199375&root=gcc&view=rev
Log:
2013-05-28 Janus Weil <janus@gcc.gnu.org>
Tobias Burnus <burnus@net-b.de>
PR fortran/57217
* interface.c (check_dummy_characteristics): Symmetrize type check.
2013-05-28 Janus Weil <janus@gcc.gnu.org>
Tobias Burnus <burnus@net-b.de>
PR fortran/57217
* gfortran.dg/typebound_override_4.f90: New.
Added:
trunk/gcc/testsuite/gfortran.dg/typebound_override_4.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/interface.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/57217] [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check
2013-05-08 17:32 [Bug fortran/57217] New: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check burnus at gcc dot gnu.org
` (4 preceding siblings ...)
2013-05-28 11:53 ` janus at gcc dot gnu.org
@ 2013-05-28 12:06 ` janus at gcc dot gnu.org
2013-05-29 21:16 ` janus at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: janus at gcc dot gnu.org @ 2013-05-28 12:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57217
--- Comment #4 from janus at gcc dot gnu.org ---
Some follow-up items:
* split type and rank check to provide better error messages
(http://gcc.gnu.org/ml/fortran/2013-05/msg00039.html)
* remove duplication in gfc_check_pointer_assign?
(http://gcc.gnu.org/ml/fortran/2013-05/msg00046.html)
* fix assumed-type/rank cases
(http://gcc.gnu.org/ml/fortran/2013-05/msg00089.html)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/57217] [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check
2013-05-08 17:32 [Bug fortran/57217] New: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check burnus at gcc dot gnu.org
` (5 preceding siblings ...)
2013-05-28 12:06 ` janus at gcc dot gnu.org
@ 2013-05-29 21:16 ` janus at gcc dot gnu.org
2013-05-29 21:39 ` janus at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: janus at gcc dot gnu.org @ 2013-05-29 21:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57217
--- Comment #5 from janus at gcc dot gnu.org ---
(In reply to janus from comment #4)
> * fix assumed-type/rank cases
> (http://gcc.gnu.org/ml/fortran/2013-05/msg00089.html)
cf. also PR 54190
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/57217] [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check
2013-05-08 17:32 [Bug fortran/57217] New: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check burnus at gcc dot gnu.org
` (6 preceding siblings ...)
2013-05-29 21:16 ` janus at gcc dot gnu.org
@ 2013-05-29 21:39 ` janus at gcc dot gnu.org
2013-05-31 8:16 ` janus at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: janus at gcc dot gnu.org @ 2013-05-29 21:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57217
--- Comment #6 from janus at gcc dot gnu.org ---
(In reply to janus from comment #4)
> * remove duplication in gfc_check_pointer_assign?
> (http://gcc.gnu.org/ml/fortran/2013-05/msg00046.html)
This apparently does not work: Removing the second call to
gfc_compare_interfaces in gfc_check_pointer_assign results (at least) in the
following failure:
FAIL: gfortran.dg/proc_ptr_result_8.f90 -O (test for errors, line 44)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/57217] [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check
2013-05-08 17:32 [Bug fortran/57217] New: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check burnus at gcc dot gnu.org
` (7 preceding siblings ...)
2013-05-29 21:39 ` janus at gcc dot gnu.org
@ 2013-05-31 8:16 ` janus at gcc dot gnu.org
2013-05-31 18:13 ` janus at gcc dot gnu.org
2013-06-01 21:39 ` janus at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: janus at gcc dot gnu.org @ 2013-05-31 8:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57217
--- Comment #7 from janus at gcc dot gnu.org ---
(In reply to janus from comment #4)
> Some follow-up items:
> * split type and rank check to provide better error messages
> (http://gcc.gnu.org/ml/fortran/2013-05/msg00039.html)
> [..]
> * fix assumed-type/rank cases
> (http://gcc.gnu.org/ml/fortran/2013-05/msg00089.html)
Both of these items have been addressed with r199475. Only the backports of the
regression fix are still pending.
Author: janus
Date: Fri May 31 08:09:09 2013
New Revision: 199475
URL: http://gcc.gnu.org/viewcvs?rev=199475&root=gcc&view=rev
Log:
2013-05-31 Janus Weil <janus@gcc.gnu.org>
PR fortran/54190
PR fortran/57217
* gfortran.h (gfc_terminal_width): Remove prototype.
* error.c (get_terminal_width): Moved here from misc.c. Renamed.
Try to determine terminal width from environment variable.
* interface.c (compare_type, compare_rank): New functions. Fix assumed
type/rank handling.
(compare_type_rank, check_dummy_characteristics,
check_result_characteristics, gfc_compare_interfaces): Use them.
(symbol_rank): Slightly modified and moved.
* misc.c (gfc_terminal_width): Moved to error.c.
2013-05-31 Janus Weil <janus@gcc.gnu.org>
PR fortran/54190
PR fortran/57217
* gfortran.dg/dummy_procedure_5.f90: Modified error message.
* gfortran.dg/interface_26.f90: Ditto.
* gfortran.dg/proc_ptr_11.f90: Ditto.
* gfortran.dg/proc_ptr_15.f90: Ditto.
* gfortran.dg/proc_ptr_comp_20.f90: Ditto.
* gfortran.dg/proc_ptr_comp_33.f90: Ditto.
* gfortran.dg/proc_ptr_result_5.f90: Ditto.
* gfortran.dg/typebound_override_1.f90: Ditto.
* gfortran.dg/typebound_override_4.f90: Ditto.
* gfortran.dg/typebound_proc_6.f03: Ditto.
* gfortran.dg/assumed_type_7.f90: New test.
* gfortran.dg/typebound_override_5.f90: New test.
* gfortran.dg/typebound_override_6.f90: New test.
* gfortran.dg/typebound_override_7.f90: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/assumed_type_7.f90
trunk/gcc/testsuite/gfortran.dg/typebound_override_5.f90
trunk/gcc/testsuite/gfortran.dg/typebound_override_6.f90
trunk/gcc/testsuite/gfortran.dg/typebound_override_7.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/error.c
trunk/gcc/fortran/gfortran.h
trunk/gcc/fortran/interface.c
trunk/gcc/fortran/misc.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/dummy_procedure_5.f90
trunk/gcc/testsuite/gfortran.dg/interface_26.f90
trunk/gcc/testsuite/gfortran.dg/proc_ptr_11.f90
trunk/gcc/testsuite/gfortran.dg/proc_ptr_15.f90
trunk/gcc/testsuite/gfortran.dg/proc_ptr_comp_20.f90
trunk/gcc/testsuite/gfortran.dg/proc_ptr_comp_33.f90
trunk/gcc/testsuite/gfortran.dg/proc_ptr_result_5.f90
trunk/gcc/testsuite/gfortran.dg/typebound_override_1.f90
trunk/gcc/testsuite/gfortran.dg/typebound_override_4.f90
trunk/gcc/testsuite/gfortran.dg/typebound_proc_6.f03
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/57217] [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check
2013-05-08 17:32 [Bug fortran/57217] New: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check burnus at gcc dot gnu.org
` (8 preceding siblings ...)
2013-05-31 8:16 ` janus at gcc dot gnu.org
@ 2013-05-31 18:13 ` janus at gcc dot gnu.org
2013-06-01 21:39 ` janus at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: janus at gcc dot gnu.org @ 2013-05-31 18:13 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57217
--- Comment #8 from janus at gcc dot gnu.org ---
Backport to 4.8:
Author: janus
Date: Fri May 31 18:10:03 2013
New Revision: 199554
URL: http://gcc.gnu.org/viewcvs?rev=199554&root=gcc&view=rev
Log:
2013-05-31 Janus Weil <janus@gcc.gnu.org>
Tobias Burnus <burnus@net-b.de>
PR fortran/57217
* interface.c (check_dummy_characteristics): Symmetrize type check.
2013-05-31 Janus Weil <janus@gcc.gnu.org>
Tobias Burnus <burnus@net-b.de>
PR fortran/57217
* gfortran.dg/typebound_override_4.f90: New.
Added:
branches/gcc-4_8-branch/gcc/testsuite/gfortran.dg/typebound_override_4.f90
Modified:
branches/gcc-4_8-branch/gcc/fortran/ChangeLog
branches/gcc-4_8-branch/gcc/fortran/interface.c
branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/57217] [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check
2013-05-08 17:32 [Bug fortran/57217] New: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check burnus at gcc dot gnu.org
` (9 preceding siblings ...)
2013-05-31 18:13 ` janus at gcc dot gnu.org
@ 2013-06-01 21:39 ` janus at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: janus at gcc dot gnu.org @ 2013-06-01 21:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57217
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #9 from janus at gcc dot gnu.org ---
Backport to 4.7:
Author: janus
Date: Sat Jun 1 21:36:33 2013
New Revision: 199586
URL: http://gcc.gnu.org/viewcvs?rev=199586&root=gcc&view=rev
Log:
2013-06-01 Janus Weil <janus@gcc.gnu.org>
Tobias Burnus <burnus@net-b.de>
PR fortran/57217
* interface.c (check_dummy_characteristics): Symmetrize type check.
2013-06-01 Janus Weil <janus@gcc.gnu.org>
Tobias Burnus <burnus@net-b.de>
PR fortran/57217
* gfortran.dg/typebound_override_4.f90: New.
Added:
branches/gcc-4_7-branch/gcc/testsuite/gfortran.dg/typebound_override_4.f90
Modified:
branches/gcc-4_7-branch/gcc/fortran/ChangeLog
branches/gcc-4_7-branch/gcc/fortran/interface.c
branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
Fixed on all active branches. Closing.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2013-06-01 21:39 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-08 17:32 [Bug fortran/57217] New: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check burnus at gcc dot gnu.org
2013-05-09 9:55 ` [Bug fortran/57217] " burnus at gcc dot gnu.org
2013-05-10 16:56 ` burnus at gcc dot gnu.org
2013-05-15 13:29 ` rguenth at gcc dot gnu.org
2013-05-28 7:15 ` janus at gcc dot gnu.org
2013-05-28 11:53 ` janus at gcc dot gnu.org
2013-05-28 12:06 ` janus at gcc dot gnu.org
2013-05-29 21:16 ` janus at gcc dot gnu.org
2013-05-29 21:39 ` janus at gcc dot gnu.org
2013-05-31 8:16 ` janus at gcc dot gnu.org
2013-05-31 18:13 ` janus at gcc dot gnu.org
2013-06-01 21:39 ` janus 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).