public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/57639] [OOP] ICE with polymorphism (and illegal code)
[not found] <bug-57639-4@http.gcc.gnu.org/bugzilla/>
@ 2013-06-20 10:28 ` janus at gcc dot gnu.org
2013-06-20 10:31 ` janus at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 4+ messages in thread
From: janus at gcc dot gnu.org @ 2013-06-20 10:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57639
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-06-20
CC| |janus at gcc dot gnu.org
Summary|ICE with polymorphism (and |[OOP] ICE with polymorphism
|illegal code) |(and illegal code)
Ever confirmed|0 |1
--- Comment #1 from janus at gcc dot gnu.org ---
Confirmed. Thanks for reporting!
Slightly reduced test case:
implicit none
class(*) :: t1, t2
print *, 'main: compare = ', compare (t1, t2)
contains
logical function compare (a, b)
class(*), intent(in), allocatable :: a, b
end function
end
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/57639] [OOP] ICE with polymorphism (and illegal code)
[not found] <bug-57639-4@http.gcc.gnu.org/bugzilla/>
2013-06-20 10:28 ` [Bug fortran/57639] [OOP] ICE with polymorphism (and illegal code) janus at gcc dot gnu.org
@ 2013-06-20 10:31 ` janus at gcc dot gnu.org
2013-06-20 11:09 ` janus at gcc dot gnu.org
2013-06-24 11:47 ` dominiq at lps dot ens.fr
3 siblings, 0 replies; 4+ messages in thread
From: janus at gcc dot gnu.org @ 2013-06-20 10:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57639
--- Comment #2 from janus at gcc dot gnu.org ---
Btw, the following variant ...
implicit none
class(*) :: t1, t2
print *, SAME_TYPE_AS (t1, t2)
end
... gives a different backtrace:
f951: internal compiler error: Segmentation fault
0x8a8cbf crash_signal
/home/janus/gcc49/trunk/gcc/toplev.c:333
0x5a89f0 gfc_type_compatible(gfc_typespec*, gfc_typespec*)
/home/janus/gcc49/trunk/gcc/fortran/symbol.c:4497
0x59afa2 gfc_simplify_same_type_as(gfc_expr*, gfc_expr*)
/home/janus/gcc49/trunk/gcc/fortran/simplify.c:2300
0x5413a1 do_simplify
/home/janus/gcc49/trunk/gcc/fortran/intrinsic.c:3962
0x54df85 gfc_intrinsic_func_interface(gfc_expr*, int)
/home/janus/gcc49/trunk/gcc/fortran/intrinsic.c:4318
0x588af4 resolve_unknown_f
/home/janus/gcc49/trunk/gcc/fortran/resolve.c:2680
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/57639] [OOP] ICE with polymorphism (and illegal code)
[not found] <bug-57639-4@http.gcc.gnu.org/bugzilla/>
2013-06-20 10:28 ` [Bug fortran/57639] [OOP] ICE with polymorphism (and illegal code) janus at gcc dot gnu.org
2013-06-20 10:31 ` janus at gcc dot gnu.org
@ 2013-06-20 11:09 ` janus at gcc dot gnu.org
2013-06-24 11:47 ` dominiq at lps dot ens.fr
3 siblings, 0 replies; 4+ messages in thread
From: janus at gcc dot gnu.org @ 2013-06-20 11:09 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57639
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |janus at gcc dot gnu.org
--- Comment #3 from janus at gcc dot gnu.org ---
The following patch fixes both variants:
Index: gcc/fortran/interface.c
===================================================================
--- gcc/fortran/interface.c (revision 199689)
+++ gcc/fortran/interface.c (working copy)
@@ -1966,7 +1966,8 @@ compare_parameter (gfc_symbol *formal, gfc_expr *a
}
/* F2008, 12.5.2.5; IR F08/0073. */
- if (formal->ts.type == BT_CLASS && actual->expr_type != EXPR_NULL
+ if (formal->ts.type == BT_CLASS && formal->attr.class_ok
+ && actual->expr_type != EXPR_NULL
&& ((CLASS_DATA (formal)->attr.class_pointer
&& !formal->attr.intent == INTENT_IN)
|| CLASS_DATA (formal)->attr.allocatable))
@@ -1978,6 +1979,10 @@ compare_parameter (gfc_symbol *formal, gfc_expr *a
formal->name, &actual->where);
return 0;
}
+
+ if (!gfc_expr_attr (actual).class_ok)
+ return 0;
+
if (!gfc_compare_derived_types (CLASS_DATA (actual)->ts.u.derived,
CLASS_DATA (formal)->ts.u.derived))
{
Index: gcc/fortran/simplify.c
===================================================================
--- gcc/fortran/simplify.c (revision 199689)
+++ gcc/fortran/simplify.c (working copy)
@@ -2296,7 +2296,8 @@ gfc_simplify_same_type_as (gfc_expr *a, gfc_expr *
/* Return .false. if the dynamic type can never be the
same. */
- if ((a->ts.type == BT_CLASS || b->ts.type == BT_CLASS)
+ if (((a->ts.type == BT_CLASS && gfc_expr_attr (a).class_ok)
+ || (b->ts.type == BT_CLASS && gfc_expr_attr (b).class_ok))
&& !gfc_type_compatible (&a->ts, &b->ts)
&& !gfc_type_compatible (&b->ts, &a->ts))
return gfc_get_logical_expr (gfc_default_logical_kind, &a->where, false);
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/57639] [OOP] ICE with polymorphism (and illegal code)
[not found] <bug-57639-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2013-06-20 11:09 ` janus at gcc dot gnu.org
@ 2013-06-24 11:47 ` dominiq at lps dot ens.fr
3 siblings, 0 replies; 4+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-06-24 11:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57639
--- Comment #5 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
(In reply to janus from comment #4)
> > The following patch fixes both variants:
>
> ... and regtests cleanly.
Confirmed.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-06-24 11:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-57639-4@http.gcc.gnu.org/bugzilla/>
2013-06-20 10:28 ` [Bug fortran/57639] [OOP] ICE with polymorphism (and illegal code) janus at gcc dot gnu.org
2013-06-20 10:31 ` janus at gcc dot gnu.org
2013-06-20 11:09 ` janus at gcc dot gnu.org
2013-06-24 11:47 ` dominiq at lps dot ens.fr
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).