Bug 57445 - [4.8/4.9 Regression][OOP] ICE in gfc_conv_class_to_class - for OPTIONAL polymorphic array
Summary: [4.8/4.9 Regression][OOP] ICE in gfc_conv_class_to_class - for OPTIONAL polym...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.9.0
: P4 normal
Target Milestone: 4.8.3
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2013-05-28 20:41 UTC by Tobias Burnus
Modified: 2013-11-30 10:59 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 4.7.3
Known to fail: 4.8.0, 4.9.0
Last reconfirmed: 2013-05-28 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2013-05-28 20:41:27 UTC
Found when working on FINALization. It compiles with GCC 4.7 but fails with GCC 4.8 and 4.9.


The following ICEs when passing an optional polymorphic array as argument to an optional dummy argument:


finalize_12.f90:12:0: internal compiler error: in gfc_conv_class_to_class, at fortran/trans-expr.c:740
     call foo_opt(xca=xca)!, xc, xaa, xca)
 ^
0x63c6f9 gfc_conv_class_to_class(gfc_se*, gfc_expr*, gfc_typespec, bool, bool, bool, bool)
        ../../gcc/fortran/trans-expr.c:740
0x637b72 gfc_conv_procedure_call(gfc_se*, gfc_symbol*, gfc_actual_arglist*, gfc_expr*, vec<tree_node*, va_gc, vl_embed>*)
        ../../gcc/fortran/trans-expr.c:4423


module m
  implicit none
  type t
    integer :: i
  end type t
contains
  subroutine opt(xa, xc, xaa, xca)
    type(t),  allocatable, intent(out), optional :: xa
    class(t), allocatable, intent(out), optional :: xc
    type(t),  allocatable, intent(out), optional :: xaa(:)
    class(t), allocatable, intent(out), optional :: xca(:)
    call foo_opt(xca=xca)!, xc, xaa, xca)
  end subroutine opt
  subroutine foo_opt(xa, xc, xaa, xca)
    type(t),  allocatable, intent(out), optional :: xa
    class(t), allocatable, intent(out), optional :: xc
    type(t),  allocatable, intent(out), optional :: xaa(:)
    class(t), allocatable, intent(out), optional :: xca(:)
  end subroutine foo_opt
end module m
Comment 1 Dominique d'Humieres 2013-05-28 22:04:32 UTC
The assert was added at revision 192495.
Comment 2 Jakub Jelinek 2013-10-16 09:48:44 UTC
GCC 4.8.2 has been released.
Comment 3 Paul Thomas 2013-11-04 19:42:26 UTC
Author: pault
Date: Mon Nov  4 19:42:24 2013
New Revision: 204356

URL: http://gcc.gnu.org/viewcvs?rev=204356&root=gcc&view=rev
Log:
2013-11-04  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/57445
	* trans-expr.c (gfc_conv_class_to_class): Remove spurious
	assert.

2013-11-04  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/57445
	* gfortran.dg/optional_class_1.f90 : New test

Added:
    trunk/gcc/testsuite/gfortran.dg/optional_class_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-expr.c
    trunk/gcc/testsuite/ChangeLog
Comment 4 Paul Thomas 2013-11-30 10:58:45 UTC
Author: pault
Date: Sat Nov 30 10:58:42 2013
New Revision: 205549

URL: http://gcc.gnu.org/viewcvs?rev=205549&root=gcc&view=rev
Log:
2013-11-30  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/57445
	* trans-expr.c (gfc_conv_class_to_class): Remove spurious
	assert.

2013-11-30  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/57445
	* gfortran.dg/optional_class_1.f90 : New test

Added:
    branches/gcc-4_8-branch/gcc/testsuite/gfortran.dg/optional_class_1.f90
Modified:
    branches/gcc-4_8-branch/gcc/fortran/ChangeLog
    branches/gcc-4_8-branch/gcc/fortran/trans-expr.c
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
Comment 5 Paul Thomas 2013-11-30 10:59:48 UTC
Fixed on trunk and 4.8.

Thanks for the report

Paul