diff options
author | Tobias Burnus <burnus@net-b.de> | 2011-01-21 08:11:05 +0100 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2011-01-21 08:11:05 +0100 |
commit | 7f1f7ffb496174346fd73b93ebaf12ee4a26685f (patch) | |
tree | 6e02b59d4c41b375b547bed5abef4e9d88701409 | |
parent | 4312bb184ca46af155be765ab73d03b1e898bb65 (diff) | |
download | gcc-7f1f7ffb496174346fd73b93ebaf12ee4a26685f.zip gcc-7f1f7ffb496174346fd73b93ebaf12ee4a26685f.tar.gz gcc-7f1f7ffb496174346fd73b93ebaf12ee4a26685f.tar.bz2 |
re PR fortran/47377 (internal compiler error: in fold_convert_loc, at fold-const.c:1906)
2011-01-21 Tobias Burnus <burnus@net-b.de>
PR fortran/47377
* expr.c (gfc_check_pointer_assign): Reject expr data-targets
without pointer attribute.
2011-01-21 Tobias Burnus <burnus@net-b.de>
PR fortran/47377
* gfortran.dg/pointer_target_4.f90: New.
From-SVN: r169079
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/expr.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pointer_target_4.f90 | 15 |
4 files changed, 35 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 8bf90a9..7ea9603 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2011-01-21 Tobias Burnus <burnus@net-b.de> + + PR fortran/47377 + * expr.c (gfc_check_pointer_assign): Reject expr data-targets + without pointer attribute. + 2011-01-18 Janus Weil <janus@gcc.gnu.org> PR fortran/47240 diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 3f1141a..bcc23fc 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -3507,6 +3507,15 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue) lvalue->symtree->n.sym->attr.subref_array_pointer = 1; attr = gfc_expr_attr (rvalue); + + if (rvalue->expr_type == EXPR_FUNCTION && !attr.pointer) + { + gfc_error ("Target expression in pointer assignment " + "at %L must deliver a pointer result", + &rvalue->where); + return FAILURE; + } + if (!attr.target && !attr.pointer) { gfc_error ("Pointer assignment target is neither TARGET " diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 45f8ef1..cc4efe7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-01-21 Tobias Burnus <burnus@net-b.de> + + PR fortran/47377 + * gfortran.dg/pointer_target_4.f90: New. + 2011-01-20 Michael Meissner <meissner@linux.vnet.ibm.com> PR target/47251 diff --git a/gcc/testsuite/gfortran.dg/pointer_target_4.f90 b/gcc/testsuite/gfortran.dg/pointer_target_4.f90 new file mode 100644 index 0000000..cda3453 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pointer_target_4.f90 @@ -0,0 +1,15 @@ +! { dg-do compile } +! +! PR fortran/47377 +! +! Contributed by <thenlich@users.sourceforge.net> +! +program testgferr + real, pointer :: y + y => f() ! { dg-error "must deliver a pointer result" } +contains + function f() + real :: f + f = 5 + end function f +end program testgferr |