From: Richard Guenther Date: Sun, 16 Aug 2009 22:36:13 +0000 (+0000) Subject: trans-expr.c (gfc_trans_scalar_assign): Replace hack with more proper hack. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fbe7af45beb2fe70468ed772d448def8ff098e5e;p=platform%2Fupstream%2Fgcc.git trans-expr.c (gfc_trans_scalar_assign): Replace hack with more proper hack. 2009-08-17 Richard Guenther * trans-expr.c (gfc_trans_scalar_assign): Replace hack with more proper hack. From-SVN: r150817 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 8ed5945..694e02f 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2009-08-17 Richard Guenther + + * trans-expr.c (gfc_trans_scalar_assign): Replace hack with + more proper hack. + 2009-08-15 Tobias Burnus PR fortran/41080 diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 51593e7..144c204 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -4432,29 +4432,21 @@ gfc_trans_scalar_assign (gfc_se * lse, gfc_se * rse, gfc_typespec ts, gfc_add_expr_to_block (&block, tmp); } } + else if (ts.type == BT_DERIVED) + { + gfc_add_block_to_block (&block, &lse->pre); + gfc_add_block_to_block (&block, &rse->pre); + tmp = gfc_evaluate_now (rse->expr, &block); + tmp = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (lse->expr), rse->expr); + gfc_add_modify (&block, lse->expr, tmp); + } else { gfc_add_block_to_block (&block, &lse->pre); gfc_add_block_to_block (&block, &rse->pre); - /* TODO This is rather obviously the wrong place to do this. - However, a number of testcases, such as function_kinds_1 - and function_types_2 fail without it, by ICEing at - fold_const: 2710 (fold_convert_loc). */ - if (ts.type == BT_DERIVED - && gfc_option.flag_whole_file - && (TYPE_MAIN_VARIANT (TREE_TYPE (rse->expr)) - != TYPE_MAIN_VARIANT (TREE_TYPE (lse->expr)))) - { - tmp = gfc_evaluate_now (rse->expr, &block); - TYPE_MAIN_VARIANT (TREE_TYPE (tmp)) - = TYPE_MAIN_VARIANT (TREE_TYPE (lse->expr)); - } - else - tmp = rse->expr; - gfc_add_modify (&block, lse->expr, - fold_convert (TREE_TYPE (lse->expr), tmp)); + fold_convert (TREE_TYPE (lse->expr), rse->expr)); } gfc_add_block_to_block (&block, &lse->post);