public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/55297] New: 4.8 Regression: type-bound operator clashes with abstract interface
@ 2012-11-12 23:17 damian at rouson dot net
2012-11-12 23:46 ` [Bug fortran/55297] [4.8 Regression] " dominiq at lps dot ens.fr
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: damian at rouson dot net @ 2012-11-12 23:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55297
Bug #: 55297
Summary: 4.8 Regression: type-bound operator clashes with
abstract interface
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: damian@rouson.net
$ cat athlete.f90
module athlete_module
type athlete
contains
procedure :: negative
generic :: operator(-) => negative
end type
abstract interface
integer function sum_interface(this)
import athlete
class(athlete) this
end function
end interface
contains
integer function negative(this)
class(athlete) ,intent(in) :: this
end function
end module
$ gfortran-mp-4.7 -c athlete.f90
$ gfortran-mp-4.8 -c athlete.f90
athlete.f90:5.29:
generic :: operator(-) => negative
1
Error: Entity 'negative' at (1) is already present in the interface
wlan-clients-2916:gnu rouson$ gfortran-mp-4.8 --version
GNU Fortran (MacPorts gcc48 4.8-20121021_0) 4.8.0 20121021 (experimental)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/55297] [4.8 Regression] type-bound operator clashes with abstract interface
2012-11-12 23:17 [Bug fortran/55297] New: 4.8 Regression: type-bound operator clashes with abstract interface damian at rouson dot net
@ 2012-11-12 23:46 ` dominiq at lps dot ens.fr
2012-11-13 11:20 ` burnus at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: dominiq at lps dot ens.fr @ 2012-11-12 23:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55297
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-11-12
CC| |janus at gcc dot gnu.org
Summary|4.8 Regression: type-bound |[4.8 Regression] type-bound
|operator clashes with |operator clashes with
|abstract interface |abstract interface
Ever Confirmed|0 |1
--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2012-11-12 23:46:10 UTC ---
Revision 188914 (2012-06-24) does not give error; revision 189336 (2012-07-06)
does.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/55297] [4.8 Regression] type-bound operator clashes with abstract interface
2012-11-12 23:17 [Bug fortran/55297] New: 4.8 Regression: type-bound operator clashes with abstract interface damian at rouson dot net
2012-11-12 23:46 ` [Bug fortran/55297] [4.8 Regression] " dominiq at lps dot ens.fr
@ 2012-11-13 11:20 ` burnus at gcc dot gnu.org
2012-11-16 11:42 ` janus at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-11-13 11:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55297
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
CC| |burnus at gcc dot gnu.org
Target Milestone|--- |4.8.0
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-11-13 11:19:24 UTC ---
Seems to be due to http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=189022
for PR fortran/41951 and PR fortran/49591.
In the resolve.c's resolve_typebound_intrinsic_op:
11546 if (gfc_check_new_interface (derived->ns->op[op],
target_proc,
11547 p->where) == FAILURE)
Here target_proc->name == "negative" and target_proc->ns->proc_name->name
== "athlete_module"
The symbol (i.e. derived type) is resolved twice: Once for the "module
athlete_module" (= gfc_current_ns->proc_name) and then again for the abstract
interface procedure "sum_interface" (= gfc_current_ns->proc_name).
In either case, one has derived->ns->proc_name->name == "athlete_module", which
causes the symbol be added twice added to the same namespace.
The question is whether it should be fixed by adding
if (derived->ns != gfc_current_ns)
return;
Or using "gfc_current_ns" instead of "derived->ns". Or what's the most
appropriate fix.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/55297] [4.8 Regression] type-bound operator clashes with abstract interface
2012-11-12 23:17 [Bug fortran/55297] New: 4.8 Regression: type-bound operator clashes with abstract interface damian at rouson dot net
2012-11-12 23:46 ` [Bug fortran/55297] [4.8 Regression] " dominiq at lps dot ens.fr
2012-11-13 11:20 ` burnus at gcc dot gnu.org
@ 2012-11-16 11:42 ` janus at gcc dot gnu.org
2012-11-16 17:02 ` [Bug fortran/55297] [4.8 Regression] [OOP] " janus at gcc dot gnu.org
2012-11-16 18:17 ` janus at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu.org @ 2012-11-16 11:42 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55297
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |janus at gcc dot gnu.org
|gnu.org |
--- Comment #3 from janus at gcc dot gnu.org 2012-11-16 11:41:50 UTC ---
(In reply to comment #2)
> The question is whether it should be fixed by adding
> if (derived->ns != gfc_current_ns)
> return;
Yes, something along this line seems like the appropriate fix to me. In
particular I would propose the following (which does fix the test case):
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (revision 193552)
+++ gcc/fortran/resolve.c (working copy)
@@ -11540,7 +11540,7 @@ resolve_typebound_intrinsic_op (gfc_symbol* derive
/* Add target to non-typebound operator list. */
if (!target->specific->deferred && !derived->attr.use_assoc
- && p->access != ACCESS_PRIVATE)
+ && p->access != ACCESS_PRIVATE && derived->ns == gfc_current_ns)
{
gfc_interface *head, *intr;
if (gfc_check_new_interface (derived->ns->op[op], target_proc,
Will commit as obvious after regtesting ...
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/55297] [4.8 Regression] [OOP] type-bound operator clashes with abstract interface
2012-11-12 23:17 [Bug fortran/55297] New: 4.8 Regression: type-bound operator clashes with abstract interface damian at rouson dot net
` (2 preceding siblings ...)
2012-11-16 11:42 ` janus at gcc dot gnu.org
@ 2012-11-16 17:02 ` janus at gcc dot gnu.org
2012-11-16 18:17 ` janus at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu.org @ 2012-11-16 17:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55297
--- Comment #4 from janus at gcc dot gnu.org 2012-11-16 17:02:07 UTC ---
Author: janus
Date: Fri Nov 16 17:02:02 2012
New Revision: 193568
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193568
Log:
2012-11-16 Janus Weil <janus@gcc.gnu.org>
PR fortran/55297
* resolve.c (resolve_typebound_intrinsic_op): Only add typebound
operators to the operator list in the namespace of the derived type.
2012-11-16 Janus Weil <janus@gcc.gnu.org>
PR fortran/55297
* gfortran.dg/typebound_operator_18.f90: New.
Added:
trunk/gcc/testsuite/gfortran.dg/typebound_operator_18.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/resolve.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/55297] [4.8 Regression] [OOP] type-bound operator clashes with abstract interface
2012-11-12 23:17 [Bug fortran/55297] New: 4.8 Regression: type-bound operator clashes with abstract interface damian at rouson dot net
` (3 preceding siblings ...)
2012-11-16 17:02 ` [Bug fortran/55297] [4.8 Regression] [OOP] " janus at gcc dot gnu.org
@ 2012-11-16 18:17 ` janus at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu.org @ 2012-11-16 18:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55297
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #5 from janus at gcc dot gnu.org 2012-11-16 18:17:28 UTC ---
Fixed with r193568. Closing.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-11-16 18:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-12 23:17 [Bug fortran/55297] New: 4.8 Regression: type-bound operator clashes with abstract interface damian at rouson dot net
2012-11-12 23:46 ` [Bug fortran/55297] [4.8 Regression] " dominiq at lps dot ens.fr
2012-11-13 11:20 ` burnus at gcc dot gnu.org
2012-11-16 11:42 ` janus at gcc dot gnu.org
2012-11-16 17:02 ` [Bug fortran/55297] [4.8 Regression] [OOP] " janus at gcc dot gnu.org
2012-11-16 18:17 ` 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).