public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/61527] New: class/extends, multiple generic assignment, accept invalid
@ 2014-06-16 16:06 mrestelli at gmail dot com
2014-06-16 16:19 ` [Bug fortran/61527] " dominiq at lps dot ens.fr
` (15 more replies)
0 siblings, 16 replies; 17+ messages in thread
From: mrestelli at gmail dot com @ 2014-06-16 16:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61527
Bug ID: 61527
Summary: class/extends, multiple generic assignment, accept
invalid
Product: gcc
Version: 4.10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: mrestelli at gmail dot com
Hi,
I see that gfortran accepts the following code (even with strict
debug flags) which is ambiguous in the resolution of the generic. The
code is correctly rejected if disp2 uses CLASS(t2) instead of
TYPE(t2), while with TYPE(T2) the code compiles and DISP2 is called,
which I think should not be allowed.
$ gfortran --version
GNU Fortran (GCC) 4.10.0 20140613 (experimental)
module m
implicit none
private
public :: t1, t2, disp
type :: t1
integer :: i = 1
end type t1
type, extends(t1) :: t2
real :: r = 2.0
end type t2
interface disp
module procedure disp1, disp2
end interface
contains
subroutine disp1(x)
class(t1), intent(in) :: x
write(*,*) "Disp 1: ",x%i
end subroutine disp1
subroutine disp2(x)
type(t2), intent(in) :: x ! <- accepted
!class(t2), intent(in) :: x ! <- rejected
write(*,*) "Disp 2: ",x%r
end subroutine disp2
end module m
program p
use m
implicit none
type(t1) :: a
type(t2) :: b
call disp(a)
call disp(b)
end program p
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug fortran/61527] class/extends, multiple generic assignment, accept invalid
2014-06-16 16:06 [Bug fortran/61527] New: class/extends, multiple generic assignment, accept invalid mrestelli at gmail dot com
@ 2014-06-16 16:19 ` dominiq at lps dot ens.fr
2014-06-16 16:38 ` mrestelli at gmail dot com
` (14 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-06-16 16:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61527
--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Up to r200946 (2013-07-14, 4.9) gfortran gives an error
Error: Ambiguous interfaces 'disp2' and 'disp1' in generic interface 'disp' at
(1)
>From at least r201266 (2013-07-26) gfortran accepts the code. I did not find
any obvious culprit in this range for the change in behavior. I also don't know
what is the correct behavior.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug fortran/61527] class/extends, multiple generic assignment, accept invalid
2014-06-16 16:06 [Bug fortran/61527] New: class/extends, multiple generic assignment, accept invalid mrestelli at gmail dot com
2014-06-16 16:19 ` [Bug fortran/61527] " dominiq at lps dot ens.fr
@ 2014-06-16 16:38 ` mrestelli at gmail dot com
2014-07-12 21:33 ` [Bug fortran/61527] [4.9/4.10 Regression] " burnus at gcc dot gnu.org
` (13 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: mrestelli at gmail dot com @ 2014-06-16 16:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61527
--- Comment #2 from mrestelli <mrestelli at gmail dot com> ---
I am no expert, but I think that the correct behaviour is that of the
older version: the two interfaces indeed are ambiguous, since a call
like
type(t2) :: b
call disp(b)
could call both disp1 and disp2.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug fortran/61527] [4.9/4.10 Regression] class/extends, multiple generic assignment, accept invalid
2014-06-16 16:06 [Bug fortran/61527] New: class/extends, multiple generic assignment, accept invalid mrestelli at gmail dot com
2014-06-16 16:19 ` [Bug fortran/61527] " dominiq at lps dot ens.fr
2014-06-16 16:38 ` mrestelli at gmail dot com
@ 2014-07-12 21:33 ` burnus at gcc dot gnu.org
2014-07-12 22:05 ` dominiq at lps dot ens.fr
` (12 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: burnus at gcc dot gnu.org @ 2014-07-12 21:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61527
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |accepts-invalid
CC| |burnus at gcc dot gnu.org
Target Milestone|--- |4.9.2
Summary|class/extends, multiple |[4.9/4.10 Regression]
|generic assignment, accept |class/extends, multiple
|invalid |generic assignment, accept
| |invalid
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
It seems to be due to the following code in interface.c, which was added for
PR57530 in r201329:
compare_type (gfc_symbol *s1, gfc_symbol *s2)
{
if (s2->attr.ext_attr & (1 << EXT_ATTR_NO_ARG_CHECK))
return 1;
/* TYPE and CLASS of the same declared type are type compatible,
but have different characteristics. */
if ((s1->ts.type == BT_CLASS && s2->ts.type == BT_DERIVED)
|| (s1->ts.type == BT_DERIVED && s2->ts.type == BT_CLASS))
return 0;
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug fortran/61527] [4.9/4.10 Regression] class/extends, multiple generic assignment, accept invalid
2014-06-16 16:06 [Bug fortran/61527] New: class/extends, multiple generic assignment, accept invalid mrestelli at gmail dot com
` (2 preceding siblings ...)
2014-07-12 21:33 ` [Bug fortran/61527] [4.9/4.10 Regression] " burnus at gcc dot gnu.org
@ 2014-07-12 22:05 ` dominiq at lps dot ens.fr
2014-10-30 10:40 ` [Bug fortran/61527] [4.9/5 " jakub at gcc dot gnu.org
` (11 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-07-12 22:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61527
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-07-12
Ever confirmed|0 |1
--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed per comment 3.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug fortran/61527] [4.9/5 Regression] class/extends, multiple generic assignment, accept invalid
2014-06-16 16:06 [Bug fortran/61527] New: class/extends, multiple generic assignment, accept invalid mrestelli at gmail dot com
` (3 preceding siblings ...)
2014-07-12 22:05 ` dominiq at lps dot ens.fr
@ 2014-10-30 10:40 ` jakub at gcc dot gnu.org
2014-11-24 16:45 ` rguenth at gcc dot gnu.org
` (10 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-10-30 10:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61527
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.9.2 |4.9.3
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 4.9.2 has been released.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug fortran/61527] [4.9/5 Regression] class/extends, multiple generic assignment, accept invalid
2014-06-16 16:06 [Bug fortran/61527] New: class/extends, multiple generic assignment, accept invalid mrestelli at gmail dot com
` (4 preceding siblings ...)
2014-10-30 10:40 ` [Bug fortran/61527] [4.9/5 " jakub at gcc dot gnu.org
@ 2014-11-24 16:45 ` rguenth at gcc dot gnu.org
2015-01-16 17:16 ` janus at gcc dot gnu.org
` (9 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-11-24 16:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61527
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P5
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug fortran/61527] [4.9/5 Regression] class/extends, multiple generic assignment, accept invalid
2014-06-16 16:06 [Bug fortran/61527] New: class/extends, multiple generic assignment, accept invalid mrestelli at gmail dot com
` (5 preceding siblings ...)
2014-11-24 16:45 ` rguenth at gcc dot gnu.org
@ 2015-01-16 17:16 ` janus at gcc dot gnu.org
2015-01-16 17:43 ` janus at gcc dot gnu.org
` (8 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: janus at gcc dot gnu.org @ 2015-01-16 17:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61527
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |janus at gcc dot gnu.org
--- Comment #6 from janus at gcc dot gnu.org ---
(In reply to Tobias Burnus from comment #3)
> It seems to be due to the following code in interface.c, which was added for
> PR57530 in r201329:
Reverting this part of the patch ...
Index: gcc/fortran/interface.c
===================================================================
--- gcc/fortran/interface.c (Revision 219753)
+++ gcc/fortran/interface.c (Arbeitskopie)
@@ -515,12 +515,6 @@
if (s2->attr.ext_attr & (1 << EXT_ATTR_NO_ARG_CHECK))
return 1;
- /* TYPE and CLASS of the same declared type are type compatible,
- but have different characteristics. */
- if ((s1->ts.type == BT_CLASS && s2->ts.type == BT_DERIVED)
- || (s1->ts.type == BT_DERIVED && s2->ts.type == BT_CLASS))
- return 0;
-
return gfc_compare_types (&s1->ts, &s2->ts) || s2->ts.type == BT_ASSUMED;
}
... indeed brings back the expected error message for comment 0. However, it
causes a few testsuite regressions:
FAIL: gfortran.dg/dummy_procedure_4.f90 -O (test for errors, line 28)
FAIL: gfortran.dg/proc_ptr_30.f90 -O (test for errors, line 25)
FAIL: gfortran.dg/proc_ptr_comp_32.f90 -O (test for errors, line 34)
FAIL: gfortran.dg/proc_ptr_comp_33.f90 -O (test for errors, line 14)
FAIL: gfortran.dg/proc_ptr_comp_33.f90 -O (test for errors, line 54)
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug fortran/61527] [4.9/5 Regression] class/extends, multiple generic assignment, accept invalid
2014-06-16 16:06 [Bug fortran/61527] New: class/extends, multiple generic assignment, accept invalid mrestelli at gmail dot com
` (6 preceding siblings ...)
2015-01-16 17:16 ` janus at gcc dot gnu.org
@ 2015-01-16 17:43 ` janus at gcc dot gnu.org
2015-06-26 20:01 ` [Bug fortran/61527] [4.9/5/6 " jakub at gcc dot gnu.org
` (7 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: janus at gcc dot gnu.org @ 2015-01-16 17:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61527
--- Comment #7 from janus at gcc dot gnu.org ---
Reverting the whole commit of r201329 does not work either, but produces a
different set of failures:
FAIL: gfortran.dg/class_to_type_3.f03 -O0 (test for excess errors)
FAIL: gfortran.dg/pointer_assign_8.f90 -O0 (test for excess errors)
FAIL: gfortran.dg/pointer_assign_9.f90 -O0 (test for excess errors)
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug fortran/61527] [4.9/5/6 Regression] class/extends, multiple generic assignment, accept invalid
2014-06-16 16:06 [Bug fortran/61527] New: class/extends, multiple generic assignment, accept invalid mrestelli at gmail dot com
` (7 preceding siblings ...)
2015-01-16 17:43 ` janus at gcc dot gnu.org
@ 2015-06-26 20:01 ` jakub at gcc dot gnu.org
2015-06-26 20:31 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-06-26 20:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61527
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 4.9.3 has been released.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug fortran/61527] [4.9/5/6 Regression] class/extends, multiple generic assignment, accept invalid
2014-06-16 16:06 [Bug fortran/61527] New: class/extends, multiple generic assignment, accept invalid mrestelli at gmail dot com
` (8 preceding siblings ...)
2015-06-26 20:01 ` [Bug fortran/61527] [4.9/5/6 " jakub at gcc dot gnu.org
@ 2015-06-26 20:31 ` jakub at gcc dot gnu.org
2021-05-14 9:47 ` [Bug fortran/61527] [9/10/11/12 Regression] [OOP] " jakub at gcc dot gnu.org
` (5 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-06-26 20:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61527
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.9.3 |4.9.4
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug fortran/61527] [9/10/11/12 Regression] [OOP] class/extends, multiple generic assignment, accept invalid
2014-06-16 16:06 [Bug fortran/61527] New: class/extends, multiple generic assignment, accept invalid mrestelli at gmail dot com
` (9 preceding siblings ...)
2015-06-26 20:31 ` jakub at gcc dot gnu.org
@ 2021-05-14 9:47 ` jakub at gcc dot gnu.org
2021-06-01 8:06 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-14 9:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61527
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|8.5 |9.4
--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 8 branch is being closed.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug fortran/61527] [9/10/11/12 Regression] [OOP] class/extends, multiple generic assignment, accept invalid
2014-06-16 16:06 [Bug fortran/61527] New: class/extends, multiple generic assignment, accept invalid mrestelli at gmail dot com
` (10 preceding siblings ...)
2021-05-14 9:47 ` [Bug fortran/61527] [9/10/11/12 Regression] [OOP] " jakub at gcc dot gnu.org
@ 2021-06-01 8:06 ` rguenth at gcc dot gnu.org
2022-05-27 9:35 ` [Bug fortran/61527] [10/11/12/13 " rguenth at gcc dot gnu.org
` (3 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-01 8:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61527
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|9.4 |9.5
--- Comment #14 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9.4 is being released, retargeting bugs to GCC 9.5.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug fortran/61527] [10/11/12/13 Regression] [OOP] class/extends, multiple generic assignment, accept invalid
2014-06-16 16:06 [Bug fortran/61527] New: class/extends, multiple generic assignment, accept invalid mrestelli at gmail dot com
` (11 preceding siblings ...)
2021-06-01 8:06 ` rguenth at gcc dot gnu.org
@ 2022-05-27 9:35 ` rguenth at gcc dot gnu.org
2022-06-28 10:30 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27 9:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61527
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|9.5 |10.4
--- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug fortran/61527] [10/11/12/13 Regression] [OOP] class/extends, multiple generic assignment, accept invalid
2014-06-16 16:06 [Bug fortran/61527] New: class/extends, multiple generic assignment, accept invalid mrestelli at gmail dot com
` (12 preceding siblings ...)
2022-05-27 9:35 ` [Bug fortran/61527] [10/11/12/13 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:30 ` jakub at gcc dot gnu.org
2023-07-07 10:30 ` [Bug fortran/61527] [11/12/13/14 " rguenth at gcc dot gnu.org
2024-04-26 10:06 ` pault at gcc dot gnu.org
15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61527
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.4 |10.5
--- Comment #16 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug fortran/61527] [11/12/13/14 Regression] [OOP] class/extends, multiple generic assignment, accept invalid
2014-06-16 16:06 [Bug fortran/61527] New: class/extends, multiple generic assignment, accept invalid mrestelli at gmail dot com
` (13 preceding siblings ...)
2022-06-28 10:30 ` jakub at gcc dot gnu.org
@ 2023-07-07 10:30 ` rguenth at gcc dot gnu.org
2024-04-26 10:06 ` pault at gcc dot gnu.org
15 siblings, 0 replies; 17+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61527
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.5 |11.5
--- Comment #17 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug fortran/61527] [11/12/13/14 Regression] [OOP] class/extends, multiple generic assignment, accept invalid
2014-06-16 16:06 [Bug fortran/61527] New: class/extends, multiple generic assignment, accept invalid mrestelli at gmail dot com
` (14 preceding siblings ...)
2023-07-07 10:30 ` [Bug fortran/61527] [11/12/13/14 " rguenth at gcc dot gnu.org
@ 2024-04-26 10:06 ` pault at gcc dot gnu.org
15 siblings, 0 replies; 17+ messages in thread
From: pault at gcc dot gnu.org @ 2024-04-26 10:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61527
Paul Thomas <pault at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
CC| |pault at gcc dot gnu.org
--- Comment #18 from Paul Thomas <pault at gcc dot gnu.org> ---
From at least 7.4.1 20191027 on, gfortran gives the correct result and detects
ambiguity for both cases. NAG and Intel agree.
Closing as resolved.
Paul
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2024-04-26 10:06 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-16 16:06 [Bug fortran/61527] New: class/extends, multiple generic assignment, accept invalid mrestelli at gmail dot com
2014-06-16 16:19 ` [Bug fortran/61527] " dominiq at lps dot ens.fr
2014-06-16 16:38 ` mrestelli at gmail dot com
2014-07-12 21:33 ` [Bug fortran/61527] [4.9/4.10 Regression] " burnus at gcc dot gnu.org
2014-07-12 22:05 ` dominiq at lps dot ens.fr
2014-10-30 10:40 ` [Bug fortran/61527] [4.9/5 " jakub at gcc dot gnu.org
2014-11-24 16:45 ` rguenth at gcc dot gnu.org
2015-01-16 17:16 ` janus at gcc dot gnu.org
2015-01-16 17:43 ` janus at gcc dot gnu.org
2015-06-26 20:01 ` [Bug fortran/61527] [4.9/5/6 " jakub at gcc dot gnu.org
2015-06-26 20:31 ` jakub at gcc dot gnu.org
2021-05-14 9:47 ` [Bug fortran/61527] [9/10/11/12 Regression] [OOP] " jakub at gcc dot gnu.org
2021-06-01 8:06 ` rguenth at gcc dot gnu.org
2022-05-27 9:35 ` [Bug fortran/61527] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:30 ` jakub at gcc dot gnu.org
2023-07-07 10:30 ` [Bug fortran/61527] [11/12/13/14 " rguenth at gcc dot gnu.org
2024-04-26 10:06 ` pault 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).