[PATCH] Fix PR41494

Richard Guenther rguenther@suse.de
Sun Oct 18 16:36:00 GMT 2009


With an earlier change I generalized the code to always call
gfc_evaluate_now, but that pessimizes code as seen in PR41494.
Originally Paul added the code for the workaround for type
problems at -fwhole-file, thus I think gfc_evaluate_now isn't
necessary at all.  Well, if it is we'd better get a testcase for that.

Bootstrapped and tested on x86_64-unknown-linux-gnu, ok for trunk?

Thanks,
Richard.

2009-10-18  Richard Guenther  <rguenther@suse.de>

	PR fortran/41494
	* trans-expr.c (gfc_trans_scalar_assign): Do not call
	gfc_evaluate_now.

Index: gcc/fortran/trans-expr.c
===================================================================
*** gcc/fortran/trans-expr.c	(revision 152966)
--- gcc/fortran/trans-expr.c	(working copy)
*************** gfc_trans_scalar_assign (gfc_se * lse, g
*** 4664,4671 ****
      {
        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), tmp);
        gfc_add_modify (&block, lse->expr, tmp);
      }
    else
--- 4664,4670 ----
      {
        gfc_add_block_to_block (&block, &lse->pre);
        gfc_add_block_to_block (&block, &rse->pre);
!       tmp = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (lse->expr), rse->expr);
        gfc_add_modify (&block, lse->expr, tmp);
      }
    else



More information about the Fortran mailing list