Commit 662ef0f5 by Tobias Schlüter

re PR fortran/12841 (passing null to a subroutine)

fortran/
PR fortran/12841
* interface.c (compare_parameter, compare_actual_formal): Don't
check types and array shapes for NULL()
* trans-expr.c (conv_function_call): No double indirection for
NULL()
( I had accidentally committed the interface.c part before)

testuite/
PR fortran/12841
* gfortran.fortran-torture/execute/null_arg.f90: New test.

From-SVN: r83028
parent 4aef80f8
2004-06-12 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/12841
* interface.c (compare_parameter, compare_actual_formal): Don't
check types and array shapes for NULL()
* trans-expr.c (conv_function_call): No double indirection for
NULL()
2004-06-09 Toon Moene <toon@moene.indiv.nluug.nl>
* trans-expr.c (gfc_conv_cst_int_power): Compute
......
......@@ -1923,7 +1923,7 @@ generate_local_decl (gfc_symbol * sym)
/* warn for unused variables, but not if they're inside a common
block. */
else if (warn_unused_variable && !sym->attr.in_common)
warning ("unused variable `%s'", sym->name);
warning ("unused variable `%s'", sym->name);
}
}
......
......@@ -1100,10 +1100,12 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym,
if (argss == gfc_ss_terminator)
{
gfc_conv_expr_reference (&parmse, arg->expr);
if (formal && formal->sym->attr.pointer)
if (formal && formal->sym->attr.pointer
&& arg->expr->expr_type != EXPR_NULL)
{
/* Scalar pointer dummy args require an extra level of
indirection. */
indirection. The null pointer already contains
this level of indirection. */
parmse.expr = gfc_build_addr_expr (NULL, parmse.expr);
}
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
! This is the testcase from PR 12841. We used to report a type/rank mismatch
! when passing NULL() as an argument to a function.
MODULE T
PUBLIC :: A
CONTAINS
SUBROUTINE A(B)
REAL, POINTER :: B
IF (ASSOCIATED(B)) CALL ABORT()
END SUBROUTINE A
END MODULE T
USE T
CALL A(NULL())
END
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment