trans-expr.c (get_proc_ptr_comp): Restore initial expression type before calling gfc_free_expr.

2010-10-06  Mikael Morin  <mikael@gcc.gnu.org>

	* trans-expr.c (get_proc_ptr_comp): Restore initial expression type
	before calling gfc_free_expr.

From-SVN: r165047
This commit is contained in:
Mikael Morin 2010-10-06 16:05:41 +00:00
parent 3db5d687b4
commit c12ee5df35
2 changed files with 12 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2010-10-06 Mikael Morin <mikael@gcc.gnu.org>
* trans-expr.c (get_proc_ptr_comp): Restore initial expression type
before calling gfc_free_expr.
2010-10-06 Mikael Morin <mikael@gcc.gnu.org>
* trans-array.c (gfc_conv_tmp_array_ref): Add factorized call to

View File

@ -1612,10 +1612,17 @@ get_proc_ptr_comp (gfc_expr *e)
{
gfc_se comp_se;
gfc_expr *e2;
expr_t old_type;
gfc_init_se (&comp_se, NULL);
e2 = gfc_copy_expr (e);
/* We have to restore the expr type later so that gfc_free_expr frees
the exact same thing that was allocated.
TODO: This is ugly. */
old_type = e2->expr_type;
e2->expr_type = EXPR_VARIABLE;
gfc_conv_expr (&comp_se, e2);
e2->expr_type = old_type;
gfc_free_expr (e2);
return build_fold_addr_expr_loc (input_location, comp_se.expr);
}