public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/55854] New: ICE on intent(out) dummy argument with unlimited polymorphic component
@ 2013-01-03 3:00 damian at rouson dot net
2013-01-03 9:41 ` [Bug fortran/55854] " burnus at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: damian at rouson dot net @ 2013-01-03 3:00 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55854
Bug #: 55854
Summary: ICE on intent(out) dummy argument with unlimited
polymorphic component
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
As demonstrated below, having an "intent(out)" dummy argument with an
unlimited polymorphic component generates an internal compiler error
with a December 23 build of gfortran 4.8:
$ cat ice_on_intent_out_with_unlimted.f90
type foo
class(*), allocatable :: x
end type
contains
subroutine bar(this)
type(foo), intent(out) :: this
end
end
$ gfortran ice_on_intent_out_with_unlimted.f90
ice_on_intent_out_with_unlimted.f90: In function 'bar':
ice_on_intent_out_with_unlimted.f90:5:0: internal compiler error:
Segmentation fault: 11
subroutine bar(this)
^
ice_on_intent_out_with_unlimted.f90:5:0: internal compiler error: Abort trap: 6
gfortran: internal compiler error: Abort trap: 6 (program f951)
Abort trap: 6
$ gfortran --version
GNU Fortran (MacPorts gcc48 4.8-20121223_0) 4.8.0 20121223 (experimental)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/55854] ICE on intent(out) dummy argument with unlimited polymorphic component
2013-01-03 3:00 [Bug fortran/55854] New: ICE on intent(out) dummy argument with unlimited polymorphic component damian at rouson dot net
@ 2013-01-03 9:41 ` burnus at gcc dot gnu.org
2013-01-03 13:04 ` burnus at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-01-03 9:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55854
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-invalid-code
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-01-03
CC| |burnus at gcc dot gnu.org,
| |pault at gcc dot gnu.org
Ever Confirmed|0 |1
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-01-03 09:40:45 UTC ---
I think it's the same as PR55763 comment 10.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/55854] ICE on intent(out) dummy argument with unlimited polymorphic component
2013-01-03 3:00 [Bug fortran/55854] New: ICE on intent(out) dummy argument with unlimited polymorphic component damian at rouson dot net
2013-01-03 9:41 ` [Bug fortran/55854] " burnus at gcc dot gnu.org
@ 2013-01-03 13:04 ` burnus at gcc dot gnu.org
2013-01-03 14:47 ` burnus at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-01-03 13:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55854
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-01-03 13:03:49 UTC ---
(In reply to comment #1)
> I think it's the same as PR55763 comment 10.
Seemingly not - at least with the patch from PR55763 comment 12, this example
crashes in:
#0 build_function_decl (sym=0x1658420, global=<optimized out>) at
../../gcc/fortran/trans-decl.c:1852
#1 0x0000000000613e37 in gfc_get_symbol_decl (sym=0x1658420) at
../../gcc/fortran/trans-decl.c:1370
The following assert fails for sym == "__copy_CLASS_0_":
1848 /* Allow only one nesting level. Allow public declarations. */
1849 gcc_assert (current_function_decl == NULL_TREE
1850 || DECL_FILE_SCOPE_P (current_function_decl)
1851 || (TREE_CODE (DECL_CONTEXT (current_function_decl))
1852 == NAMESPACE_DECL));
Here, "current_function_decl" is "function_decl bar.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/55854] ICE on intent(out) dummy argument with unlimited polymorphic component
2013-01-03 3:00 [Bug fortran/55854] New: ICE on intent(out) dummy argument with unlimited polymorphic component damian at rouson dot net
2013-01-03 9:41 ` [Bug fortran/55854] " burnus at gcc dot gnu.org
2013-01-03 13:04 ` burnus at gcc dot gnu.org
@ 2013-01-03 14:47 ` burnus at gcc dot gnu.org
2013-01-03 18:12 ` damian at rouson dot net
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-01-03 14:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55854
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-01-03 14:46:54 UTC ---
The problem seems to be the "gfc_class_null_initializer", where "ts" is
unlimited polymorphic and "init_expr" is of type "__class__$tar_a" (and
EXPR_NULL). The latter leads to the generation of __vtab_CLASS_0_ with the
associated _copy function.
Besides the wrong type, the generation _copy is triggered very late, namely in
gfc_trans_deferred_vars-> gfc_trans_structure_assign. That's the reason for
using the wrong scope and - hence - for the ICE.
Patch:
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -414,7 +414,7 @@ gfc_class_null_initializer (gfc_typespec *ts, gfc_expr
*init_expr)
&& ts->u.derived->components->ts.u.derived->attr.unlimited_polymorphic;
if (is_unlimited_polymorphic && init_expr)
- vtab = gfc_find_intrinsic_vtab (&(init_expr->ts));
+ vtab = gfc_find_intrinsic_vtab (&ts->u.derived->components->ts);
else
vtab = gfc_find_derived_vtab (ts->u.derived);
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/55854] ICE on intent(out) dummy argument with unlimited polymorphic component
2013-01-03 3:00 [Bug fortran/55854] New: ICE on intent(out) dummy argument with unlimited polymorphic component damian at rouson dot net
` (2 preceding siblings ...)
2013-01-03 14:47 ` burnus at gcc dot gnu.org
@ 2013-01-03 18:12 ` damian at rouson dot net
2013-01-03 18:55 ` burnus at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: damian at rouson dot net @ 2013-01-03 18:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55854
--- Comment #4 from Damian Rouson <damian at rouson dot net> 2013-01-03 18:11:56 UTC ---
Apparently an ICE also occurs if the argument intent is removed but "type" is
replaced by "class." See below. Is this fixed by the patch in comment 3?
Damian
$ cat ice_on_class_dummy_with_unlimited.f90
implicit none
type foo
class(*), allocatable :: bar
end type
contains
integer function foobar(this)
class(foo) :: this
end function
end
$ gfortran ice_on_class_dummy_with_unlimited.f90
ice_on_class_dummy_with_unlimited.f90: In function 'MAIN__':
ice_on_class_dummy_with_unlimited.f90:8:0: internal compiler error:
Segmentation fault: 11
end function
^
ice_on_class_dummy_with_unlimited.f90:8:0: internal compiler error: Abort trap:
6
gfortran: internal compiler error: Abort trap: 6 (program f951)
Abort trap: 6
$ gfortran --version
GNU Fortran (MacPorts gcc48 4.8-20121223_0) 4.8.0 20121223 (experimental)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/55854] ICE on intent(out) dummy argument with unlimited polymorphic component
2013-01-03 3:00 [Bug fortran/55854] New: ICE on intent(out) dummy argument with unlimited polymorphic component damian at rouson dot net
` (3 preceding siblings ...)
2013-01-03 18:12 ` damian at rouson dot net
@ 2013-01-03 18:55 ` burnus at gcc dot gnu.org
2013-01-03 19:12 ` damian at rouson dot net
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-01-03 18:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55854
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |burnus at gcc dot gnu.org
|gnu.org |
--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-01-03 18:55:16 UTC ---
(In reply to comment #4)
> Apparently an ICE also occurs if the argument intent is removed but "type" is
> replaced by "class." See below. Is this fixed by the patch in comment 3?
Seems to be fixed by the patch, which has been submitted at
http://gcc.gnu.org/ml/fortran/2013-01/msg00017.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/55854] ICE on intent(out) dummy argument with unlimited polymorphic component
2013-01-03 3:00 [Bug fortran/55854] New: ICE on intent(out) dummy argument with unlimited polymorphic component damian at rouson dot net
` (4 preceding siblings ...)
2013-01-03 18:55 ` burnus at gcc dot gnu.org
@ 2013-01-03 19:12 ` damian at rouson dot net
2013-01-04 8:58 ` burnus at gcc dot gnu.org
2013-01-04 9:01 ` burnus at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: damian at rouson dot net @ 2013-01-03 19:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55854
--- Comment #6 from Damian Rouson <damian at rouson dot net> 2013-01-03 19:12:09 UTC ---
Awesome -- thanks! Please let me know once this hits the trunk so I can
request an update of the macports build and try it out.
Damian
(In reply to comment #5)
> (In reply to comment #4)
> > Apparently an ICE also occurs if the argument intent is removed but "type" is
> > replaced by "class." See below. Is this fixed by the patch in comment 3?
>
> Seems to be fixed by the patch, which has been submitted at
> http://gcc.gnu.org/ml/fortran/2013-01/msg00017.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/55854] ICE on intent(out) dummy argument with unlimited polymorphic component
2013-01-03 3:00 [Bug fortran/55854] New: ICE on intent(out) dummy argument with unlimited polymorphic component damian at rouson dot net
` (5 preceding siblings ...)
2013-01-03 19:12 ` damian at rouson dot net
@ 2013-01-04 8:58 ` burnus at gcc dot gnu.org
2013-01-04 9:01 ` burnus at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-01-04 8:58 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55854
--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-01-04 08:58:03 UTC ---
Author: burnus
Date: Fri Jan 4 08:57:58 2013
New Revision: 194885
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194885
Log:
2013-01-03 Tobias Burnus <burnus@net-b.de>
PR fortran/55854
PR fortran/55763
* class.c (gfc_class_null_initializer): Fix finding the vtab.
(gfc_find_intrinsic_vtab): Use BT_VOID for some components.
2013-01-03 Tobias Burnus <burnus@net-b.de>
PR fortran/55854
PR fortran/55763
* gfortran.dg/unlimited_polymorphic_3.f03: Remove invalid code.
* gfortran.dg/unlimited_polymorphic_7.f90: New.
* gfortran.dg/unlimited_polymorphic_8.f90: New.
Added:
trunk/gcc/testsuite/gfortran.dg/unlimited_polymorphic_7.f90
trunk/gcc/testsuite/gfortran.dg/unlimited_polymorphic_8.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/class.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/unlimited_polymorphic_3.f03
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/55854] ICE on intent(out) dummy argument with unlimited polymorphic component
2013-01-03 3:00 [Bug fortran/55854] New: ICE on intent(out) dummy argument with unlimited polymorphic component damian at rouson dot net
` (6 preceding siblings ...)
2013-01-04 8:58 ` burnus at gcc dot gnu.org
@ 2013-01-04 9:01 ` burnus at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-01-04 9:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55854
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #8 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-01-04 09:00:33 UTC ---
FIXED on 4.8 trunk.
Thanks for the report!
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-01-04 9:01 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-03 3:00 [Bug fortran/55854] New: ICE on intent(out) dummy argument with unlimited polymorphic component damian at rouson dot net
2013-01-03 9:41 ` [Bug fortran/55854] " burnus at gcc dot gnu.org
2013-01-03 13:04 ` burnus at gcc dot gnu.org
2013-01-03 14:47 ` burnus at gcc dot gnu.org
2013-01-03 18:12 ` damian at rouson dot net
2013-01-03 18:55 ` burnus at gcc dot gnu.org
2013-01-03 19:12 ` damian at rouson dot net
2013-01-04 8:58 ` burnus at gcc dot gnu.org
2013-01-04 9:01 ` burnus 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).