aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/trans-expr.c22
2 files changed, 21 insertions, 8 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index f7b85b0..932527e 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2008-01-06 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/34387
+ * trans-expr.c (gfc_conv_missing_dummy): Use a temporary to type convert
+ the dummy variable expression, test for NULL, and pass the variable
+ address to the called function.
+
2007-01-06 Tobias Burnus <burnus@net-b.de>
PR fortran/34658
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 53cd7e6..65c65e3 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -154,18 +154,24 @@ gfc_conv_missing_dummy (gfc_se * se, gfc_expr * arg, gfc_typespec ts, int kind)
present = gfc_conv_expr_present (arg->symtree->n.sym);
- tmp = build3 (COND_EXPR, TREE_TYPE (se->expr), present, se->expr,
- fold_convert (TREE_TYPE (se->expr), integer_zero_node));
- tmp = gfc_evaluate_now (tmp, &se->pre);
-
if (kind > 0)
{
+ /* Create a temporary and convert it to the correct type. */
tmp = gfc_get_int_type (kind);
- tmp = fold_convert (tmp, se->expr);
- tmp = gfc_evaluate_now (tmp, &se->pre);
+ tmp = fold_convert (tmp, build_fold_indirect_ref (se->expr));
+
+ /* Test for a NULL value. */
+ tmp = build3 (COND_EXPR, TREE_TYPE (tmp), present, tmp, integer_one_node);
+ tmp = gfc_evaluate_now (tmp, &se->pre);
+ se->expr = build_fold_addr_expr (tmp);
+ }
+ else
+ {
+ tmp = build3 (COND_EXPR, TREE_TYPE (se->expr), present, se->expr,
+ fold_convert (TREE_TYPE (se->expr), integer_zero_node));
+ tmp = gfc_evaluate_now (tmp, &se->pre);
+ se->expr = tmp;
}
-
- se->expr = tmp;
if (ts.type == BT_CHARACTER)
{