http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51870
Bug #: 51870 Summary: [OOP] ICE with ALLOCATE and SOURCE-expr function returning BT_CLASS Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: fortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: bur...@gcc.gnu.org When compiling the following program, one gets: main.F90: In function ‘MAIN__’: main.F90:23:0: internal compiler error: in fold_convert_loc, at fold-const.c:1894 While compiling with crayftn gives no error. Backtrace: #0 fold_convert_loc (loc=0, type=0x2aaaace2c7e0, arg=<optimized out>) at gcc/fold-const.c:1894 #1 0x00000000005a5800 in gfc_allocate_allocatable (block=0x7fffffffd800, mem=0x2aaaacf262d8, size=0x2aaaacf26310, token=0x0, status=0x0, errmsg=0x0, errlen=0x0, label_finish=0x0, expr=0x16e8f10) at gcc/fortran/trans.c:749 #2 0x000000000060092f in gfc_trans_allocate (code=<optimized out>) at gcc/fortran/trans-stmt.c:4918 The failing assert is: 1893 gcc_assert (TREE_CODE (orig) == VECTOR_TYPE 1894 && tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (orig))); module show_producer_class implicit none type integrand end type integrand type show_producer contains procedure ,nopass :: create_show end type contains function create_show() result(new_integrand) class(integrand) ,allocatable :: new_integrand allocate(new_integrand) end function end module program main use show_producer_class implicit none class(integrand) ,allocatable :: kernel type(show_producer) :: executive_producer allocate(kernel,source=executive_producer%create_show() ) end program