diff options
author | Richard Guenther <rguenther@suse.de> | 2009-08-16 22:36:13 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2009-08-16 22:36:13 +0000 |
commit | fbe7af45beb2fe70468ed772d448def8ff098e5e (patch) | |
tree | 0d830a7f31ecbe922751da4a71c6f72cc9e511e4 /gcc/fortran | |
parent | a6494e5388a9cf5ae58fff5458bee68c801bb257 (diff) | |
download | gcc-fbe7af45beb2fe70468ed772d448def8ff098e5e.zip gcc-fbe7af45beb2fe70468ed772d448def8ff098e5e.tar.gz gcc-fbe7af45beb2fe70468ed772d448def8ff098e5e.tar.bz2 |
trans-expr.c (gfc_trans_scalar_assign): Replace hack with more proper hack.
2009-08-17 Richard Guenther <rguenther@suse.de>
* trans-expr.c (gfc_trans_scalar_assign): Replace hack with
more proper hack.
From-SVN: r150817
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/fortran/trans-expr.c | 26 |
2 files changed, 14 insertions, 17 deletions
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 <rguenther@suse.de> + + * trans-expr.c (gfc_trans_scalar_assign): Replace hack with + more proper hack. + 2009-08-15 Tobias Burnus <burnus@net-b.de> 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); |