http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55824
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-12-29 10:12:46 UTC --- >From trans-stmt.c's gfc_trans_allocate /* Evaluate expr3 just once if not a variable. */ ... && code->expr3->ts.type == BT_CLASS && code->expr3->expr_type != EXPR_VARIABLE) ... classexpr = gfc_evaluate_now (classexpr, &se.pre); I think we should handle intrinsic functions in a special way as they never change the actual type BT_CLASS; thus, the actual type can be taken from the actual argument of RESHAPE/TRANSPOSE. (Though, check that "transfer(f())" doesn't evaluate "f" twice.) (If one skips that if block, the ICE occurs in gfc_array_allocate when obtaining the size via gfc_array_init_size.)