http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50960
--- Comment #17 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-11-03 14:34:02 UTC --- (In reply to comment #16) > (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. Missing handling of se.want_pointer at least here: void gfc_conv_structure (gfc_se * se, gfc_expr * expr, int init) { ... if (!init) { /* Create a temporary variable and fill it in. */ se->expr = gfc_create_var (type, expr->ts.u.derived->name); tmp = gfc_trans_structure_assign (se->expr, expr); gfc_add_expr_to_block (&se->pre, tmp); return; but what's the desire of the caller? Is it to get &expr? Something seems to be seriously wrong.