diff options
author | Tobias Burnus <burnus@net-b.de> | 2010-02-03 09:26:08 +0100 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2010-02-03 09:26:08 +0100 |
commit | d8a8dab31c72d09222f42cdce6cc65d2437c8762 (patch) | |
tree | 73c8a5aef1a09b5453b90f76643270931f047026 /gcc/fortran/interface.c | |
parent | 23f8e984b7983df4b06836a0662174c0331162ae (diff) | |
download | gcc-d8a8dab31c72d09222f42cdce6cc65d2437c8762.zip gcc-d8a8dab31c72d09222f42cdce6cc65d2437c8762.tar.gz gcc-d8a8dab31c72d09222f42cdce6cc65d2437c8762.tar.bz2 |
re PR fortran/42936 (Result of passing NULL() as actual arg doesn't inherit characteristics from the corresponding dummy arg)
2010-02-03 Tobias Burnus <burnus@net-b.de>
PR fortran/42936
* interface.c (compare_parameter): Disable rank-checking
for NULL().
2010-02-03 Tobias Burnus <burnus@net-b.de>
PR fortran/42936
* gfortran.dg/null_4.f90: New test.
From-SVN: r156461
Diffstat (limited to 'gcc/fortran/interface.c')
-rw-r--r-- | gcc/fortran/interface.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index f27d75c..7bccaa6 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -1449,9 +1449,11 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, rank_check = where != NULL && !is_elemental && formal->as && (formal->as->type == AS_ASSUMED_SHAPE - || formal->as->type == AS_DEFERRED); + || formal->as->type == AS_DEFERRED) + && actual->expr_type != EXPR_NULL; - if (rank_check || ranks_must_agree || formal->attr.pointer + if (rank_check || ranks_must_agree + || (formal->attr.pointer && actual->expr_type != EXPR_NULL) || (actual->rank != 0 && !(is_elemental || formal->attr.dimension)) || (actual->rank == 0 && formal->as->type == AS_ASSUMED_SHAPE)) { @@ -1493,7 +1495,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, else return 1; } - else if (ref == NULL) + else if (ref == NULL && actual->expr_type != EXPR_NULL) { if (where) gfc_error ("Rank mismatch in argument '%s' at %L (%d and %d)", |