http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50718
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-10-13 18:46:33 UTC --- Untested draft patch: --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -3344,2 +3344,4 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, { + tree arg; + if (attr.allocatable @@ -3359,6 +3361,12 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, + arg = parmse.expr; + + /* If the argument is passed by value, we need to strip the + INDIRECT_REF. */ + if (!POINTER_TYPE_P (TREE_TYPE (parmse.expr))) + arg = gfc_build_addr_expr (NULL_TREE, arg); cond = fold_build2_loc (input_location, EQ_EXPR, - boolean_type_node, parmse.expr, - fold_convert (TREE_TYPE (parmse.expr), + boolean_type_node, arg + fold_convert (TREE_TYPE (arg), null_pointer_node));