summaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-17 17:03:59 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-17 17:03:59 +0000
commit4b17ee64cb8a01dc6205f52ea7cdae9eabbc4278 (patch)
tree6c015b63cc6e338720dfed71d317ed87374b1c41 /gcc/fortran
parentc29be2e8fe4ea90960c4ddf54f7de911244d463e (diff)
downloadgcc-4b17ee64cb8a01dc6205f52ea7cdae9eabbc4278.tar.gz
2012-03-17 Tobias Burnus <burnus@net-b.de>
PR fortran/52585 * trans-intrinsic.c (gfc_conv_associated): Fix handling of procpointer dummy arguments. 2012-03-17 Tobias Burnus <burnus@net-b.de> PR fortran/52585 * gfortran.dg/proc_ptr_36.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185485 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/trans-intrinsic.c33
2 files changed, 29 insertions, 10 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index bdc2d849ee8..115747ea960 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2012-03-17 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/52585
+ * trans-intrinsic.c (gfc_conv_associated): Fix handling of
+ procpointer dummy arguments.
+
2012-03-16 Janne Blomqvist <jb@gcc.gnu.org>
* trans-intrinsic.c (build_round_expr): Don't use BUILT_IN_IROUND
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 876eec55076..ab4f47fc5d3 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -5761,10 +5761,14 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr)
/* No optional target. */
if (ss1 == gfc_ss_terminator)
{
- /* A pointer to a scalar. */
- arg1se.want_pointer = 1;
- gfc_conv_expr (&arg1se, arg1->expr);
- tmp2 = arg1se.expr;
+ /* A pointer to a scalar. */
+ arg1se.want_pointer = 1;
+ gfc_conv_expr (&arg1se, arg1->expr);
+ if (arg1->expr->symtree->n.sym->attr.proc_pointer
+ && arg1->expr->symtree->n.sym->attr.dummy)
+ arg1se.expr = build_fold_indirect_ref_loc (input_location,
+ arg1se.expr);
+ tmp2 = arg1se.expr;
}
else
{
@@ -5794,12 +5798,21 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr)
if (ss1 == gfc_ss_terminator)
{
- /* A pointer to a scalar. */
- gcc_assert (ss2 == gfc_ss_terminator);
- arg1se.want_pointer = 1;
- gfc_conv_expr (&arg1se, arg1->expr);
- arg2se.want_pointer = 1;
- gfc_conv_expr (&arg2se, arg2->expr);
+ /* A pointer to a scalar. */
+ gcc_assert (ss2 == gfc_ss_terminator);
+ arg1se.want_pointer = 1;
+ gfc_conv_expr (&arg1se, arg1->expr);
+ if (arg1->expr->symtree->n.sym->attr.proc_pointer
+ && arg1->expr->symtree->n.sym->attr.dummy)
+ arg1se.expr = build_fold_indirect_ref_loc (input_location,
+ arg1se.expr);
+
+ arg2se.want_pointer = 1;
+ gfc_conv_expr (&arg2se, arg2->expr);
+ if (arg2->expr->symtree->n.sym->attr.proc_pointer
+ && arg2->expr->symtree->n.sym->attr.dummy)
+ arg2se.expr = build_fold_indirect_ref_loc (input_location,
+ arg2se.expr);
gfc_add_block_to_block (&se->pre, &arg1se.pre);
gfc_add_block_to_block (&se->post, &arg1se.post);
tmp = fold_build2_loc (input_location, EQ_EXPR, boolean_type_node,