Bug 60529 - [4.9/4.10 Regression] [OOP] ICE with allocatable sub-component
Summary: [4.9/4.10 Regression] [OOP] ICE with allocatable sub-component
Status: RESOLVED DUPLICATE of bug 59765
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.9.0
: P4 normal
Target Milestone: 4.9.2
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2014-03-14 17:55 UTC by Carlos A. Cruz
Modified: 2015-02-08 15:42 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2014-03-15 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos A. Cruz 2014-03-14 17:55:38 UTC
Using the following compiler release:

GNU Fortran (GCC) 4.9.0 20140309 (experimental)

on the following reproducer:

---
module T_mod
  implicit none
  type :: TS
    integer, allocatable :: i(:)
  end type TS
  type :: T
! The following line causes an internal compiler error.
    type (TS) :: s(1) 
! The following line does not:
!    type (TS), allocatable :: s(:)
  end type T
contains
  subroutine insert(this)
    class(T) :: this
  end subroutine insert
end module T_mod
---

yields an internal compiler error:

repro.F90: In function ‘__final_t_mod_T’:
repro.F90:19:0: internal compiler error: in gfc_conv_descriptor_data_get, at fortran/trans-array.c:145
 end module T_mod
 ^
0x511048 ???
        ../sysdeps/x86_64/elf/start.S:113


I am running on a Linux cluster:

Linux discover28 2.6.32.54-0.3-default #1 SMP 2012-01-27 17:38:56 +0100 x86_64 x86_64 x86_64 GNU/Linux

Note that the internal compiler error does not occur with two earlier releases of gfortran:

GNU Fortran (GCC) 4.9.0 20140105 (experimental)

GNU Fortran (GCC) 4.8.1
Comment 1 janus 2014-03-15 10:35:49 UTC
Confirmed. Slightly reduced test case:

  implicit none
  type :: TS
    integer, allocatable :: i
  end type
  type :: T
    type (TS) :: s(1)
  end type
  class(T), allocatable :: X
end

Does not show an error with 4.6, 4.7 and 4.8.

Backtrace with 4.9:

0x61ea98 gfc_conv_descriptor_data_get(tree_node*)
	/home/jweil/gcc49/trunk/gcc/fortran/trans-array.c:145
0x6245a0 gfc_array_deallocate(tree_node*, tree_node*, tree_node*, tree_node*, tree_node*, gfc_expr*)
	/home/jweil/gcc49/trunk/gcc/fortran/trans-array.c:5340
0x66bf8d gfc_trans_deallocate(gfc_code*)
	/home/jweil/gcc49/trunk/gcc/fortran/trans-stmt.c:5476
0x61b5a7 trans_code
	/home/jweil/gcc49/trunk/gcc/fortran/trans.c:1782
0x669bd1 gfc_trans_simple_do
	/home/jweil/gcc49/trunk/gcc/fortran/trans-stmt.c:1438
0x669bd1 gfc_trans_do(gfc_code*, tree_node*)
	/home/jweil/gcc49/trunk/gcc/fortran/trans-stmt.c:1601
0x61b66a trans_code
	/home/jweil/gcc49/trunk/gcc/fortran/trans.c:1732
0x63b132 gfc_generate_function_code(gfc_namespace*)
	/home/jweil/gcc49/trunk/gcc/fortran/trans-decl.c:5610
0x63afe7 gfc_generate_contained_functions
	/home/jweil/gcc49/trunk/gcc/fortran/trans-decl.c:4728
0x63afe7 gfc_generate_function_code(gfc_namespace*)
	/home/jweil/gcc49/trunk/gcc/fortran/trans-decl.c:5546

Probably caused by the finalization implementation?
Comment 2 Dominique d'Humieres 2014-03-15 10:56:51 UTC
r206362 (2014-01-06) is OK, r206567 (2014-01-12) gives the ICE.

> Probably caused by the finalization implementation?

Author: janus
Date: Mon Jan  6 23:21:39 2014
New Revision: 206379

URL: http://gcc.gnu.org/viewcvs?rev=206379&root=gcc&view=rev
Log:
2014-01-06  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/59589
	* class.c (comp_is_finalizable): New function to dermine if a given
	component is finalizable.
	(finalize_component, generate_finalization_wrapper): Use it.


2014-01-06  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/59589
	* gfortran.dg/class_allocate_16.f90: New.

Added:
    trunk/gcc/testsuite/gfortran.dg/class_allocate_16.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/class.c
    trunk/gcc/testsuite/ChangeLog

is in the range.
Comment 3 Jakub Jelinek 2014-04-22 11:35:33 UTC
GCC 4.9.0 has been released
Comment 4 Jakub Jelinek 2014-07-16 13:27:04 UTC
GCC 4.9.1 has been released.
Comment 5 Dominique d'Humieres 2014-07-17 17:20:39 UTC
Per pr61819, duplicate of pr 59765.

*** This bug has been marked as a duplicate of bug 59765 ***
Comment 6 Paul Thomas 2015-02-08 15:42:20 UTC
This is the same as PR64932 and PR59765. I have posted a patch for the former.

Thanks for pointing this out Dominique!

Paul