aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMikael Morin <mikael@gcc.gnu.org>2010-10-06 16:05:41 +0000
committerMikael Morin <mikael@gcc.gnu.org>2010-10-06 16:05:41 +0000
commitc12ee5df35dad4a053195d2e8aef16b7758d77d8 (patch)
tree964b919a4c0da5d062e184855ef3f9c5fa163968 /gcc
parent3db5d687b485630201b905fae8f54cf39c65cc6a (diff)
downloadgcc-c12ee5df35dad4a053195d2e8aef16b7758d77d8.zip
gcc-c12ee5df35dad4a053195d2e8aef16b7758d77d8.tar.gz
gcc-c12ee5df35dad4a053195d2e8aef16b7758d77d8.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog5
-rw-r--r--gcc/fortran/trans-expr.c7
2 files changed, 12 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 4c8cec4..dc0bfbb 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,5 +1,10 @@
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
gfc_advance_se_ss_chain.
* trans-expr.c (gfc_conv_subref_array_ref, gfc_conv_procedure_call,
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index d662d20..c1588f8 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -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);
}