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
This commit is contained in:
Tobias Burnus 2011-01-21 08:11:05 +01:00 committed by Tobias Burnus
parent 4312bb184c
commit 7f1f7ffb49
4 changed files with 35 additions and 0 deletions

View File

@ -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

View File

@ -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 "

View File

@ -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

View File

@ -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