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
This commit is contained in:
Tobias Schlüter 2004-06-12 16:06:19 +02:00
parent 4aef80f8e0
commit 662ef0f5c6
5 changed files with 41 additions and 5869 deletions

View File

@ -1,3 +1,11 @@
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

View File

@ -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);
}
}

View File

@ -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);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,13 @@
! 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