diff options
author | Tobias Burnus <burnus@net-b.de> | 2010-08-15 17:47:11 +0200 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2010-08-15 17:47:11 +0200 |
commit | 7d54ef80fef93c68354ffa09448ad9c6e32c1545 (patch) | |
tree | d4d7313d4da26b28bb2ce6b89e5dbe342e1c4118 /gcc/fortran/interface.c | |
parent | e6c148988cfe585abf4eb2d3f1839f97a83cc1a9 (diff) | |
download | gcc-7d54ef80fef93c68354ffa09448ad9c6e32c1545.zip gcc-7d54ef80fef93c68354ffa09448ad9c6e32c1545.tar.gz gcc-7d54ef80fef93c68354ffa09448ad9c6e32c1545.tar.bz2 |
interface.c (compare_pointer, ): Allow passing TARGETs to pointers dummies with intent(in).
2010-08-15 Tobias Burnus <burnus@net-b.de>
* interface.c (compare_pointer, ): Allow passing TARGETs to
pointers dummies with intent(in).
2010-08-15 Tobias Burnus <burnus@net-b.de>
* gfortran.dg/pointer_target_1.f90: New.
* gfortran.dg/pointer_target_2.f90: New.
* gfortran.dg/pointer_target_3.f90: New.
From-SVN: r163262
Diffstat (limited to 'gcc/fortran/interface.c')
-rw-r--r-- | gcc/fortran/interface.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index 1e72a90..fa32c5c 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -1368,6 +1368,11 @@ compare_pointer (gfc_symbol *formal, gfc_expr *actual) if (formal->attr.pointer) { attr = gfc_expr_attr (actual); + + /* Fortran 2008 allows non-pointer actual arguments. */ + if (!attr.pointer && attr.target && formal->attr.intent == INTENT_IN) + return 2; + if (!attr.pointer) return 0; } @@ -2113,6 +2118,17 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, return 0; } + if (a->expr->expr_type != EXPR_NULL + && (gfc_option.allow_std & GFC_STD_F2008) == 0 + && compare_pointer (f->sym, a->expr) == 2) + { + if (where) + gfc_error ("Fortran 2008: Non-pointer actual argument at %L to " + "pointer dummy '%s'", &a->expr->where,f->sym->name); + return 0; + } + + /* Fortran 2008, C1242. */ if (f->sym->attr.pointer && gfc_is_coindexed (a->expr)) { |