http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50960
--- Comment #16 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-11-03 14:29:29 UTC --- (In reply to comment #11) > (In reply to comment #9) > > FAIL: gfortran.dg/extends_type_of_1.f03 -O0 (internal compiler error) > > FAIL: gfortran.dg/extends_type_of_3.f90 -O (internal compiler error) > > These two fail with: > > internal compiler error: in fold_convert_loc, at fold-const.c:1894 > > Not quite sure what goes wrong there. Some typing problem? > > > Reduced test case: > > type :: t1 > end type > > type, extends(t1) :: t2 > end type > > class(t1), pointer :: c1 > type(t2) :: y > > if (.not. extends_type_of (y, c1)) call abort() > > end Looks like you are converting struct __vtype_MAIN___T1 to struct __vtype_MAIN___T1 *. Thus probably too many TREE_TYPE () wrappers somewhere or a forgotten address-taking. Called from 4608 { 4609 /* Scalar pointers. */ 4610 se.want_pointer = 1; 4611 gfc_conv_expr (&se, expr); 4612 gfc_add_block_to_block (&block, &se.pre); 4613 gfc_add_modify (&block, dest, 4614 fold_convert (TREE_TYPE (dest), se.expr)) where se.want_pointer (whatever it means) is not honored and se.expr is a variable of type struct __vtype_MAIN___T1.